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

yast / yast-bootloader / 11817815252

13 Nov 2024 01:01PM UTC coverage: 87.695%. Remained the same
11817815252

push

github

schubi2
grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

rubocop

rubocop

grub2bls

grub2bls

grub2bls

sync text about secure boot on s390 to be correct (bsc#1219989)

make rubocop happy

rubocop

rubocop

fixed test cases

fixed test cases

grub2bls

grub2bls

grub2bls

grub2bls

grub2bls

rubocop

rubocop

rubocop

rubocop

rubocop

docu

added yast-bootloader

added yast-bootloader

93 of 100 new or added lines in 7 files covered. (93.0%)

64 existing lines in 6 files now uncovered.

3371 of 3844 relevant lines covered (87.7%)

13.03 hits per line

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

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

3
require "yast"
1✔
4

5
require "bootloader/bootloader_factory"
1✔
6
require "bootloader/cpu_mitigations"
1✔
7

8
require "cwm/widget"
1✔
9

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

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

19
      super
8✔
20
    end
21

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

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

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

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

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

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

53
      names[name] or raise "Unknown supported bootloader '#{name}'"
10✔
54
    end
55

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
UNCOV
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

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

75
      if !Yast::Stage.initial && (old_bl == "systemd-boot")
1✔
UNCOV
76
        Yast::Popup.Warning(_(
×
77
        "Switching from systemd-boot to another bootloader\n" \
78
        "is currently not supported.\n"
79
      ))
UNCOV
80
        return :redraw
×
81
      end
82

83
      BootloaderFactory.current_name = new_bl
1✔
84
      BootloaderFactory.current.propose
1✔
85

86
      :redraw
1✔
87
    end
88

89
    def help
1✔
90
      _(
1✔
91
        "<p><b>Boot Loader</b>\n" \
92
        "specifies which boot loader to install. Can be also set to <tt>None</tt> " \
93
        "which means that the boot loader configuration is not managed by YaST and also " \
94
        "the kernel post install script does not update the boot loader configuration."
95
      )
96
    end
97
  end
98

99
  # Represents decision if smt is enabled
100
  class CpuMitigationsWidget < CWM::ComboBox
1✔
101
    def initialize
1✔
102
      textdomain "bootloader"
22✔
103

104
      super
22✔
105
    end
106

107
    def label
1✔
108
      _("CPU Mitigations")
4✔
109
    end
110

111
    def items
1✔
112
      ::Bootloader::CpuMitigations::ALL.map do |m|
4✔
113
        [m.value.to_s, m.to_human_string]
16✔
114
      end
115
    end
116

117
    def help
1✔
118
      _(
4✔
119
        "<p><b>CPU Mitigations</b><br>\n" \
120
        "The option selects which default settings should be used for CPU \n" \
121
        "side channels mitigations. A highlevel description is on our Technical Information \n" \
122
        "Document TID 7023836. Following options are available:<ul>\n" \
123
        "<li><b>Auto</b>: This option enables all the mitigations needed for your CPU model. \n" \
124
        "This setting can impact performance to some degree, depending on CPU model and \n" \
125
        "workload. It provides all security mitigations, but it does not protect against \n" \
126
        "cross-CPU thread attacks.</li>\n" \
127
        "<li><b>Auto + No SMT</b>: This option enables all the above mitigations in \n" \
128
        "\"Auto\", and also disables Simultaneous Multithreading to avoid \n" \
129
        "side channel attacks across multiple CPU threads. This setting can \n" \
130
        "further impact performance, depending on your \n" \
131
        "workload. This setting provides the full set of available security mitigations.</li>\n" \
132
        "<li><b>Off</b>: All CPU Mitigations are disabled. This setting has no performance \n" \
133
        "impact, but side channel attacks against your CPU are possible, depending on CPU \n" \
134
        "model.</li>\n" \
135
        "<li><b>Manual</b>: This setting does not specify a mitigation level and leaves \n" \
136
        "this to be the kernel default. The administrator can add other mitigations options \n" \
137
        "in the <i>kernel command line</i> widget.\n" \
138
        "All CPU mitigation specific options can be set manually.</li></ul></p>"
139
      )
140
    end
141

142
    def init
1✔
143
      if Bootloader::BootloaderFactory.current.respond_to?(:cpu_mitigations)
2✔
UNCOV
144
        self.value = Bootloader::BootloaderFactory.current.cpu_mitigations.value.to_s
×
145
      else
146
        disable
2✔
147
      end
148
    end
149

150
    def store
1✔
151
      return unless enabled?
2✔
152

UNCOV
153
      Bootloader::BootloaderFactory.current.cpu_mitigations =
×
154
        ::Bootloader::CpuMitigations.new(value.to_sym)
155
    end
156
  end
157

158
  # represents kernel command line
159
  class KernelAppendWidget < CWM::InputField
1✔
160
    def initialize
1✔
161
      textdomain "bootloader"
10✔
162

163
      super
10✔
164
    end
165

166
    def label
1✔
167
      _("O&ptional Kernel Command Line Parameter")
2✔
168
    end
169

170
    def help
1✔
171
      _(
2✔
172
        "<p><b>Optional Kernel Command Line Parameter</b> lets you define " \
173
        "additional parameters to pass to the kernel.</p>"
174
      )
175
    end
176

177
    def init
1✔
178
      current_bl = ::Bootloader::BootloaderFactory.current
2✔
179
      case current_bl
2✔
180
      when ::Bootloader::SystemdBoot
181
        self.value = current_bl.kernel_params.serialize.gsub(/mitigations=\S+/, "")
1✔
182
      when ::Bootloader::Grub2Base
183
        self.value = current_bl.grub_default.kernel_params.serialize.gsub(/mitigations=\S+/, "")
1✔
184
      else
UNCOV
185
        disable
×
186
      end
187
    end
188

189
    def store
1✔
190
      return unless enabled?
2✔
191

192
      current_bl = ::Bootloader::BootloaderFactory.current
2✔
193
      case current_bl
2✔
194
      when ::Bootloader::SystemdBoot
195
        current_bl.kernel_params.replace(value)
1✔
196
      when ::Bootloader::Grub2Base
197
        current_bl.grub_default.kernel_params.replace(value)
1✔
198
      else
UNCOV
199
        log.error("Bootloader type #{current_bl} not found.")
×
200
      end
201
    end
202
  end
203
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