• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yast / yast-bootloader / 6034542486

31 Aug 2023 07:50AM UTC coverage: 87.597%. First build
6034542486

Pull #686

github

schubi2
version changed; added changes entry
Pull Request #686: Systemd boot feature

735 of 735 new or added lines in 15 files covered. (100.0%)

3171 of 3620 relevant lines covered (87.6%)

12.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.93
/src/lib/bootloader/generic_widgets.rb
1
# frozen_string_literal: true
2

3
require "yast"
1✔
4

5
require "bootloader/bootloader_factory"
1✔
6

7
require "cwm/widget"
1✔
8

9
Yast.import "UI"
1✔
10
Yast.import "Popup"
1✔
11

12
module Bootloader
1✔
13
  # Widget to switch between all supported bootloaders
14
  class LoaderTypeWidget < CWM::ComboBox
1✔
15
    def initialize
1✔
16
      textdomain "bootloader"
8✔
17

18
      super
8✔
19
    end
20

21
    def label
1✔
22
      textdomain "bootloader"
1✔
23

24
      _("&Boot Loader")
1✔
25
    end
26

27
    def init
1✔
28
      self.value = BootloaderFactory.current.name
×
29
    end
30

31
    def opt
1✔
32
      [:notify]
2✔
33
    end
34

35
    def items
1✔
36
      BootloaderFactory.supported_names.map do |name|
2✔
37
        [name, localized_names(name)]
6✔
38
      end
39
    end
40

41
    def localized_names(name)
1✔
42
      names = {
43
        "grub2"        => _("GRUB2"),
6✔
44
        "grub2-efi"    => _("GRUB2 for EFI"),
45
        # Translators: option in combo box when bootloader is not managed by yast2
46
        "systemd-boot" => _("Systemd Boot"),
47
        "none"         => _("Not Managed"),
48
        "default"      => _("Default")
49
      }
50

51
      names[name] or raise "Unknown supported bootloader '#{name}'"
6✔
52
    end
53

54
    # rubocop:disable Metrics/MethodLength
55
    # It will be reduced again if systemd-boot is not anymore in beta phase.
56
    def handle
1✔
57
      old_bl = BootloaderFactory.current.name
1✔
58
      new_bl = value
1✔
59

60
      return nil if old_bl == new_bl
1✔
61

62
      if new_bl == "none"
1✔
63
        # popup - Continue/Cancel
64
        popup_msg = _(
×
65
          "\n" \
66
          "If you do not install any boot loader, the system\n" \
67
          "might not start.\n" \
68
          "\n" \
69
          "Proceed?\n"
70
        )
71

72
        return :redraw if !Yast::Popup.ContinueCancel(popup_msg)
×
73
      end
74

75
      if new_bl == "systemd-boot"
1✔
76
        # popup - Continue/Cancel
77
        popup_msg = _(
×
78
          "\n" \
79
          "Systemd-boot support is currently work in progress and\n" \
80
          "may not work as expected. Use at your own risk.\n" \
81
          "\n" \
82
          "Currently we do not provide official maintenance or support.\n" \
83
          "Proceed?\n"
84
        )
85

86
        return :redraw if !Yast::Popup.ContinueCancel(popup_msg)
×
87
      end
88

89
      if !Yast::Stage.initial && (old_bl == "systemd-boot")
1✔
90
        Yast::Popup.Warning(_(
×
91
        "Switching from systemd-boot to another bootloader\n" \
92
        "is currently not supported.\n"
93
      ))
94
        return :redraw
×
95
      end
96

97
      BootloaderFactory.current_name = new_bl
1✔
98
      BootloaderFactory.current.propose
1✔
99

100
      :redraw
1✔
101
    end
102

103
    # rubocop:enable Metrics/MethodLength
104
    def help
1✔
105
      _(
1✔
106
        "<p><b>Boot Loader</b>\n" \
107
        "specifies which boot loader to install. Can be also set to <tt>None</tt> " \
108
        "which means that the boot loader configuration is not managed by YaST and also " \
109
        "the kernel post install script does not update the boot loader configuration."
110
      )
111
    end
112
  end
113
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc