Skip to content

Commit 35cdb19

Browse files
authored
Merge pull request #702 from aplanas/fix_menue
Rename menue_timeout to menu_timeout
2 parents 686e7f0 + d367429 commit 35cdb19

9 files changed

+58
-52
lines changed

package/yast2-bootloader.changes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
-------------------------------------------------------------------
2+
Fri Jul 19 11:46:46 UTC 2024 - Alberto Planas Dominguez <[email protected]>
3+
4+
- Rename menue_timeout (menü) to menu_timeout
5+
- Reference in text messages to menu
6+
17
-------------------------------------------------------------------
28
Fri May 3 13:07:26 UTC 2024 - Stefan Schubert <schubi@localhost>
39

src/lib/bootloader/autoyast_converter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def import(data)
4949
bootloader.cpu_mitigations = CpuMitigations.from_string(cpu_mitigations)
5050
end
5151
when "systemd-boot"
52-
bootloader.menue_timeout = data.global.timeout
52+
bootloader.menu_timeout = data.global.timeout
5353
bootloader.secure_boot = data.global.secure_boot
5454
else
5555
raise UnsupportedBootloader, bootloader.name
@@ -80,7 +80,7 @@ def export(config)
8080
export_password(global, config.password)
8181
res["global"]["cpu_mitigations"] = config.cpu_mitigations.value.to_s
8282
when "systemd-boot"
83-
res["global"]["timeout"] = config.menue_timeout
83+
res["global"]["timeout"] = config.menu_timeout
8484
res["global"]["secure_boot"] = config.secure_boot
8585
else
8686
raise UnsupportedBootloader, bootloader.name

src/lib/bootloader/systemdboot.rb

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class SystemdBoot < BootloaderBase
2121

2222
CMDLINE = "/etc/kernel/cmdline"
2323

24-
# @!attribute menue_timeout
25-
# @return [Integer] menue timeout
26-
attr_accessor :menue_timeout
24+
# @!attribute menu_timeout
25+
# @return [Integer] menu timeout
26+
attr_accessor :menu_timeout
2727

2828
# @!attribute secure_boot
2929
# @return [Boolean] current secure boot setting
@@ -45,14 +45,14 @@ def kernel_params
4545

4646
# rubocop:disable Metrics/AbcSize
4747
def merge(other)
48-
log.info "merging: timeout: #{menue_timeout}=>#{other.menue_timeout}"
48+
log.info "merging: timeout: #{menu_timeout}=>#{other.menu_timeout}"
4949
log.info " secure_boot: #{secure_boot}=>#{other.secure_boot}"
5050
log.info " mitigations: #{cpu_mitigations.to_human_string}=>" \
5151
"#{other.cpu_mitigations.to_human_string}"
5252
log.info " kernel_params: #{kernel_params.serialize}=>" \
5353
"#{other.kernel_params.serialize}"
5454
super
55-
self.menue_timeout = other.menue_timeout unless other.menue_timeout.nil?
55+
self.menu_timeout = other.menu_timeout unless other.menu_timeout.nil?
5656
self.secure_boot = other.secure_boot unless other.secure_boot.nil?
5757

5858
kernel_serialize = kernel_params.serialize
@@ -71,7 +71,7 @@ def merge(other)
7171
# explicitly set mitigations means overwrite of our
7272
self.cpu_mitigations = other.cpu_mitigations if other.explicit_cpu_mitigations
7373

74-
log.info "merging result: timeout: #{menue_timeout}"
74+
log.info "merging result: timeout: #{menu_timeout}"
7575
log.info " secure_boot: #{secure_boot}"
7676
log.info " mitigations: #{cpu_mitigations.to_human_string}"
7777
log.info " kernel_params: #{kernel_params.serialize}"
@@ -95,7 +95,7 @@ def cpu_mitigations=(value)
9595
def read
9696
super
9797

98-
read_menue_timeout
98+
read_menu_timeout
9999
self.secure_boot = Systeminfo.secure_boot_active?
100100

101101
lines = ""
@@ -113,8 +113,8 @@ def write(etc_only: false)
113113
super
114114
log.info("Writing settings...")
115115
install_bootloader if Yast::Stage.initial # while new installation only (currently)
116-
create_menue_entries
117-
write_menue_timeout
116+
create_menu_entries
117+
write_menu_timeout
118118

119119
true
120120
end
@@ -126,7 +126,7 @@ def propose
126126
kernel_line = Yast::BootArch.DefaultKernelParams(Yast::BootStorage.propose_resume)
127127
@kernel_container.kernel_params.replace(kernel_line)
128128
end
129-
self.menue_timeout = Yast::ProductFeatures.GetIntegerFeature("globals", "boot_timeout").to_i
129+
self.menu_timeout = Yast::ProductFeatures.GetIntegerFeature("globals", "boot_timeout").to_i
130130
self.secure_boot = Systeminfo.secure_boot_supported?
131131
end
132132

@@ -199,7 +199,7 @@ def write_sysconfig(prewrite: false)
199199

200200
SDBOOTUTIL = "/usr/bin/sdbootutil"
201201

202-
def create_menue_entries
202+
def create_menu_entries
203203
# writing kernel parameter to /etc/kernel/cmdline
204204
File.open(File.join(Yast::Installation.destdir, CMDLINE), "w+") do |fw|
205205
if Yast::Stage.initial # while new installation only
@@ -214,31 +214,31 @@ def create_menue_entries
214214
rescue Cheetah::ExecutionFailed => e
215215
Yast::Report.Error(
216216
format(_(
217-
"Cannot create systemd-boot menue entry:\n" \
217+
"Cannot create systemd-boot menu entry:\n" \
218218
"Command `%{command}`.\n" \
219219
"Error output: %{stderr}"
220220
), command: e.commands.inspect, stderr: e.stderr)
221221
)
222222
end
223223
end
224224

225-
def read_menue_timeout
225+
def read_menu_timeout
226226
config = CFA::SystemdBoot.load
227-
return unless config.menue_timeout
227+
return unless config.menu_timeout
228228

229-
self.menue_timeout = if config.menue_timeout == "menu-force"
229+
self.menu_timeout = if config.menu_timeout == "menu-force"
230230
-1
231231
else
232-
config.menue_timeout.to_i
232+
config.menu_timeout.to_i
233233
end
234234
end
235235

236-
def write_menue_timeout
236+
def write_menu_timeout
237237
config = CFA::SystemdBoot.load
238-
config.menue_timeout = if menue_timeout == -1
238+
config.menu_timeout = if menu_timeout == -1
239239
"menu-force"
240240
else
241-
menue_timeout.to_s
241+
menu_timeout.to_s
242242
end
243243
config.save
244244
end

src/lib/bootloader/systemdboot_widgets.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def contents
3939
false,
4040
HBox(
4141
IntField(Id(:seconds), _("&Timeout in Seconds"), @minimum, @maximum,
42-
systemdboot.menue_timeout.to_i),
42+
systemdboot.menu_timeout.to_i),
4343
HStretch()
4444
)
4545
)
@@ -52,14 +52,14 @@ def help
5252
end
5353

5454
def init
55-
Yast::UI.ChangeWidget(Id(:cont_boot), :Value, systemdboot.menue_timeout >= 0)
56-
systemdboot.menue_timeout = default_value if systemdboot.menue_timeout < 0
57-
Yast::UI.ChangeWidget(Id(:seconds), :Value, systemdboot.menue_timeout)
55+
Yast::UI.ChangeWidget(Id(:cont_boot), :Value, systemdboot.menu_timeout >= 0)
56+
systemdboot.menu_timeout = default_value if systemdboot.menu_timeout < 0
57+
Yast::UI.ChangeWidget(Id(:seconds), :Value, systemdboot.menu_timeout)
5858
end
5959

6060
def store
6161
cont_boot = Yast::UI.QueryWidget(Id(:cont_boot), :Value)
62-
systemdboot.menue_timeout = cont_boot ? Yast::UI.QueryWidget(Id(:seconds), :Value) : -1
62+
systemdboot.menu_timeout = cont_boot ? Yast::UI.QueryWidget(Id(:seconds), :Value) : -1
6363
end
6464

6565
private

src/lib/cfa/systemd_boot.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@ module CFA
3030
# @example Reading a value
3131
# file = CFA::SystemdBoot.new
3232
# file.load
33-
# file.menue_timeout #=> 10
33+
# file.menu_timeout #=> 10
3434
#
3535
# @example Writing a value
3636
# file = CFA::SystemdBoot.new
37-
# file.menue_timeout = 5
37+
# file.menu_timeout = 5
3838
# file.save
3939
#
4040
# @example Loading shortcut
4141
# file = CFA::SystemdBoot.load
42-
# file.menue_timeout #=> 10
42+
# file.menu_timeout #=> 10
4343
class SystemdBoot < BaseModel
4444
extend Yast::Logger
4545
include Yast::Logger
4646

4747
attributes(
48-
menue_timeout: "timeout",
49-
console_mode: "console_mode",
50-
default: "default"
48+
menu_timeout: "timeout",
49+
console_mode: "console_mode",
50+
default: "default"
5151
)
5252

5353
# Instantiates and loads a file when possible

test/autoyast_converter_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
section = Bootloader::AutoinstProfile::BootloaderSection.new_from_hashes(data)
128128
bootloader = subject.import(section)
129129
expect(bootloader).to be_a(Bootloader::SystemdBoot)
130-
expect(bootloader.menue_timeout).to eq 30
130+
expect(bootloader.menu_timeout).to eq 30
131131
expect(bootloader.secure_boot).to eq true
132132
end
133133
end
@@ -194,7 +194,7 @@
194194
expect(subject.export(bootloader)["global"]["secure_boot"]).to eq true
195195
end
196196
it "exports timeout key" do
197-
bootloader.menue_timeout = 20
197+
bootloader.menu_timeout = 20
198198
expect(subject.export(bootloader)["global"]["timeout"]).to eq 20
199199
end
200200
end

test/cfa/systemd_boot_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@
5353
end
5454
end
5555

56-
describe "#menue_timeout" do
56+
describe "#menu_timeout" do
5757
it "returns the timeout value" do
58-
expect(subject.menue_timeout).to eq("10")
58+
expect(subject.menu_timeout).to eq("10")
5959
end
6060
end
6161

62-
describe "#menue_timeout=" do
63-
it "sets the menue_timeout value" do
64-
expect { subject.menue_timeout = "15" }
65-
.to change { subject.menue_timeout }.from("10").to("15")
62+
describe "#menu_timeout=" do
63+
it "sets the menu_timeout value" do
64+
expect { subject.menu_timeout = "15" }
65+
.to change { subject.menu_timeout }.from("10").to("15")
6666
end
6767
end
6868

@@ -74,7 +74,7 @@
7474
allow(file_handler).to receive(:read).with(file_path)
7575
.and_return("# Some comment\ntimeout 5")
7676
subject.load
77-
subject.menue_timeout = timeout
77+
subject.menu_timeout = timeout
7878
end
7979

8080
it "writes changes to configuration file" do

test/systemdboot_test.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
allow(Yast::Stage).to receive(:initial).and_return(true)
4646
allow(Yast::Installation).to receive(:destdir).and_return(destdir)
4747
subject.kernel_params.replace(cmdline_content)
48-
subject.menue_timeout = 10
48+
subject.menu_timeout = 10
4949
end
5050

5151
it "installs the bootloader" do
@@ -74,25 +74,25 @@
7474
expect(subject.kernel_params.serialize).to include cmdline_content
7575
end
7676

77-
it "creates menue entries" do
77+
it "creates menu entries" do
7878
allow(Yast::Execute).to receive(:on_target!)
7979
.with("/usr/bin/sdbootutil", "--verbose", "install")
8080
allow_any_instance_of(CFA::SystemdBoot).to receive(:save)
8181

82-
# create menue entries
82+
# create menu entries
8383
expect(Yast::Execute).to receive(:on_target!)
8484
.with("/usr/bin/sdbootutil", "--verbose", "add-all-kernels")
8585

8686
subject.write
8787
end
8888

89-
it "saves menue timeout" do
89+
it "saves menu timeout" do
9090
allow(Yast::Execute).to receive(:on_target!)
9191
.with("/usr/bin/sdbootutil", "--verbose", "install")
9292
allow(Yast::Execute).to receive(:on_target!)
9393
.with("/usr/bin/sdbootutil", "--verbose", "add-all-kernels")
9494

95-
# Saving menue timeout
95+
# Saving menu timeout
9696
expect_any_instance_of(CFA::SystemdBoot).to receive(:save)
9797

9898
subject.write
@@ -121,21 +121,21 @@
121121
end
122122

123123
describe "#merge" do
124-
it "overwrite secure boot, mitigations and menue timeout if specified in merged one" do
124+
it "overwrite secure boot, mitigations and menu timeout if specified in merged one" do
125125
other_cmdline = "splash=silent quiet mitigations=auto"
126126
other = described_class.new
127127
other.secure_boot = true
128-
other.menue_timeout = 12
128+
other.menu_timeout = 12
129129
other.kernel_params.replace(other_cmdline)
130130

131131
subject.secure_boot = false
132-
subject.menue_timeout = 10
132+
subject.menu_timeout = 10
133133
subject.kernel_params.replace(cmdline_content)
134134

135135
subject.merge(other)
136136

137137
expect(subject.secure_boot).to eq true
138-
expect(subject.menue_timeout).to eq 12
138+
expect(subject.menu_timeout).to eq 12
139139
expect(subject.cpu_mitigations.to_human_string).to eq "Auto"
140140
expect(subject.kernel_params.serialize).to include "security=apparmor splash=silent quiet mitigations=auto"
141141
end
@@ -147,7 +147,7 @@
147147
.with("globals", "boot_timeout").and_return(2)
148148
subject.propose
149149

150-
expect(subject.menue_timeout).to eq 2
150+
expect(subject.menu_timeout).to eq 2
151151
end
152152

153153
it "proposes secure boot" do

test/systemdboot_widgets_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def stub_widget_value(id, value)
5858
it "sets timeout to -1 for using menu-force" do
5959
subject.store
6060

61-
expect(bootloader.menue_timeout).to eq(-1)
61+
expect(bootloader.menu_timeout).to eq(-1)
6262
end
6363
end
6464
end

0 commit comments

Comments
 (0)