From d3674297677b0928c46669adbc785fb27163b7e2 Mon Sep 17 00:00:00 2001 From: Alberto Planas Date: Fri, 19 Jul 2024 13:48:31 +0200 Subject: [PATCH] Rename menue_timeout to menu_timeout Signed-off-by: Alberto Planas --- package/yast2-bootloader.changes | 6 ++++ src/lib/bootloader/autoyast_converter.rb | 4 +-- src/lib/bootloader/systemdboot.rb | 38 +++++++++++------------ src/lib/bootloader/systemdboot_widgets.rb | 10 +++--- src/lib/cfa/systemd_boot.rb | 12 +++---- test/autoyast_converter_test.rb | 4 +-- test/cfa/systemd_boot_test.rb | 14 ++++----- test/systemdboot_test.rb | 20 ++++++------ test/systemdboot_widgets_test.rb | 2 +- 9 files changed, 58 insertions(+), 52 deletions(-) diff --git a/package/yast2-bootloader.changes b/package/yast2-bootloader.changes index a52f66536..d54ed663d 100644 --- a/package/yast2-bootloader.changes +++ b/package/yast2-bootloader.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jul 19 11:46:46 UTC 2024 - Alberto Planas Dominguez + +- Rename menue_timeout (menĂ¼) to menu_timeout +- Reference in text messages to menu + ------------------------------------------------------------------- Fri May 3 13:07:26 UTC 2024 - Stefan Schubert diff --git a/src/lib/bootloader/autoyast_converter.rb b/src/lib/bootloader/autoyast_converter.rb index ad3e2b09f..bbb698ccc 100644 --- a/src/lib/bootloader/autoyast_converter.rb +++ b/src/lib/bootloader/autoyast_converter.rb @@ -49,7 +49,7 @@ def import(data) bootloader.cpu_mitigations = CpuMitigations.from_string(cpu_mitigations) end when "systemd-boot" - bootloader.menue_timeout = data.global.timeout + bootloader.menu_timeout = data.global.timeout bootloader.secure_boot = data.global.secure_boot else raise UnsupportedBootloader, bootloader.name @@ -80,7 +80,7 @@ def export(config) export_password(global, config.password) res["global"]["cpu_mitigations"] = config.cpu_mitigations.value.to_s when "systemd-boot" - res["global"]["timeout"] = config.menue_timeout + res["global"]["timeout"] = config.menu_timeout res["global"]["secure_boot"] = config.secure_boot else raise UnsupportedBootloader, bootloader.name diff --git a/src/lib/bootloader/systemdboot.rb b/src/lib/bootloader/systemdboot.rb index a69a81e8d..b525afa5c 100644 --- a/src/lib/bootloader/systemdboot.rb +++ b/src/lib/bootloader/systemdboot.rb @@ -21,9 +21,9 @@ class SystemdBoot < BootloaderBase CMDLINE = "/etc/kernel/cmdline" - # @!attribute menue_timeout - # @return [Integer] menue timeout - attr_accessor :menue_timeout + # @!attribute menu_timeout + # @return [Integer] menu timeout + attr_accessor :menu_timeout # @!attribute secure_boot # @return [Boolean] current secure boot setting @@ -45,14 +45,14 @@ def kernel_params # rubocop:disable Metrics/AbcSize def merge(other) - log.info "merging: timeout: #{menue_timeout}=>#{other.menue_timeout}" + log.info "merging: timeout: #{menu_timeout}=>#{other.menu_timeout}" log.info " secure_boot: #{secure_boot}=>#{other.secure_boot}" log.info " mitigations: #{cpu_mitigations.to_human_string}=>" \ "#{other.cpu_mitigations.to_human_string}" log.info " kernel_params: #{kernel_params.serialize}=>" \ "#{other.kernel_params.serialize}" super - self.menue_timeout = other.menue_timeout unless other.menue_timeout.nil? + self.menu_timeout = other.menu_timeout unless other.menu_timeout.nil? self.secure_boot = other.secure_boot unless other.secure_boot.nil? kernel_serialize = kernel_params.serialize @@ -71,7 +71,7 @@ def merge(other) # explicitly set mitigations means overwrite of our self.cpu_mitigations = other.cpu_mitigations if other.explicit_cpu_mitigations - log.info "merging result: timeout: #{menue_timeout}" + log.info "merging result: timeout: #{menu_timeout}" log.info " secure_boot: #{secure_boot}" log.info " mitigations: #{cpu_mitigations.to_human_string}" log.info " kernel_params: #{kernel_params.serialize}" @@ -95,7 +95,7 @@ def cpu_mitigations=(value) def read super - read_menue_timeout + read_menu_timeout self.secure_boot = Systeminfo.secure_boot_active? lines = "" @@ -113,8 +113,8 @@ def write(etc_only: false) super log.info("Writing settings...") install_bootloader if Yast::Stage.initial # while new installation only (currently) - create_menue_entries - write_menue_timeout + create_menu_entries + write_menu_timeout true end @@ -126,7 +126,7 @@ def propose kernel_line = Yast::BootArch.DefaultKernelParams(Yast::BootStorage.propose_resume) @kernel_container.kernel_params.replace(kernel_line) end - self.menue_timeout = Yast::ProductFeatures.GetIntegerFeature("globals", "boot_timeout").to_i + self.menu_timeout = Yast::ProductFeatures.GetIntegerFeature("globals", "boot_timeout").to_i self.secure_boot = Systeminfo.secure_boot_supported? end @@ -199,7 +199,7 @@ def write_sysconfig(prewrite: false) SDBOOTUTIL = "/usr/bin/sdbootutil" - def create_menue_entries + def create_menu_entries # writing kernel parameter to /etc/kernel/cmdline File.open(File.join(Yast::Installation.destdir, CMDLINE), "w+") do |fw| if Yast::Stage.initial # while new installation only @@ -214,7 +214,7 @@ def create_menue_entries rescue Cheetah::ExecutionFailed => e Yast::Report.Error( format(_( - "Cannot create systemd-boot menue entry:\n" \ + "Cannot create systemd-boot menu entry:\n" \ "Command `%{command}`.\n" \ "Error output: %{stderr}" ), command: e.commands.inspect, stderr: e.stderr) @@ -222,23 +222,23 @@ def create_menue_entries end end - def read_menue_timeout + def read_menu_timeout config = CFA::SystemdBoot.load - return unless config.menue_timeout + return unless config.menu_timeout - self.menue_timeout = if config.menue_timeout == "menu-force" + self.menu_timeout = if config.menu_timeout == "menu-force" -1 else - config.menue_timeout.to_i + config.menu_timeout.to_i end end - def write_menue_timeout + def write_menu_timeout config = CFA::SystemdBoot.load - config.menue_timeout = if menue_timeout == -1 + config.menu_timeout = if menu_timeout == -1 "menu-force" else - menue_timeout.to_s + menu_timeout.to_s end config.save end diff --git a/src/lib/bootloader/systemdboot_widgets.rb b/src/lib/bootloader/systemdboot_widgets.rb index 66ee98755..e921ccfd0 100644 --- a/src/lib/bootloader/systemdboot_widgets.rb +++ b/src/lib/bootloader/systemdboot_widgets.rb @@ -39,7 +39,7 @@ def contents false, HBox( IntField(Id(:seconds), _("&Timeout in Seconds"), @minimum, @maximum, - systemdboot.menue_timeout.to_i), + systemdboot.menu_timeout.to_i), HStretch() ) ) @@ -52,14 +52,14 @@ def help end def init - Yast::UI.ChangeWidget(Id(:cont_boot), :Value, systemdboot.menue_timeout >= 0) - systemdboot.menue_timeout = default_value if systemdboot.menue_timeout < 0 - Yast::UI.ChangeWidget(Id(:seconds), :Value, systemdboot.menue_timeout) + Yast::UI.ChangeWidget(Id(:cont_boot), :Value, systemdboot.menu_timeout >= 0) + systemdboot.menu_timeout = default_value if systemdboot.menu_timeout < 0 + Yast::UI.ChangeWidget(Id(:seconds), :Value, systemdboot.menu_timeout) end def store cont_boot = Yast::UI.QueryWidget(Id(:cont_boot), :Value) - systemdboot.menue_timeout = cont_boot ? Yast::UI.QueryWidget(Id(:seconds), :Value) : -1 + systemdboot.menu_timeout = cont_boot ? Yast::UI.QueryWidget(Id(:seconds), :Value) : -1 end private diff --git a/src/lib/cfa/systemd_boot.rb b/src/lib/cfa/systemd_boot.rb index f31476840..2105346cc 100644 --- a/src/lib/cfa/systemd_boot.rb +++ b/src/lib/cfa/systemd_boot.rb @@ -30,24 +30,24 @@ module CFA # @example Reading a value # file = CFA::SystemdBoot.new # file.load - # file.menue_timeout #=> 10 + # file.menu_timeout #=> 10 # # @example Writing a value # file = CFA::SystemdBoot.new - # file.menue_timeout = 5 + # file.menu_timeout = 5 # file.save # # @example Loading shortcut # file = CFA::SystemdBoot.load - # file.menue_timeout #=> 10 + # file.menu_timeout #=> 10 class SystemdBoot < BaseModel extend Yast::Logger include Yast::Logger attributes( - menue_timeout: "timeout", - console_mode: "console_mode", - default: "default" + menu_timeout: "timeout", + console_mode: "console_mode", + default: "default" ) # Instantiates and loads a file when possible diff --git a/test/autoyast_converter_test.rb b/test/autoyast_converter_test.rb index 8a9308d30..a003be4d2 100644 --- a/test/autoyast_converter_test.rb +++ b/test/autoyast_converter_test.rb @@ -127,7 +127,7 @@ section = Bootloader::AutoinstProfile::BootloaderSection.new_from_hashes(data) bootloader = subject.import(section) expect(bootloader).to be_a(Bootloader::SystemdBoot) - expect(bootloader.menue_timeout).to eq 30 + expect(bootloader.menu_timeout).to eq 30 expect(bootloader.secure_boot).to eq true end end @@ -194,7 +194,7 @@ expect(subject.export(bootloader)["global"]["secure_boot"]).to eq true end it "exports timeout key" do - bootloader.menue_timeout = 20 + bootloader.menu_timeout = 20 expect(subject.export(bootloader)["global"]["timeout"]).to eq 20 end end diff --git a/test/cfa/systemd_boot_test.rb b/test/cfa/systemd_boot_test.rb index 266db4c5d..a4df09fc3 100644 --- a/test/cfa/systemd_boot_test.rb +++ b/test/cfa/systemd_boot_test.rb @@ -53,16 +53,16 @@ end end - describe "#menue_timeout" do + describe "#menu_timeout" do it "returns the timeout value" do - expect(subject.menue_timeout).to eq("10") + expect(subject.menu_timeout).to eq("10") end end - describe "#menue_timeout=" do - it "sets the menue_timeout value" do - expect { subject.menue_timeout = "15" } - .to change { subject.menue_timeout }.from("10").to("15") + describe "#menu_timeout=" do + it "sets the menu_timeout value" do + expect { subject.menu_timeout = "15" } + .to change { subject.menu_timeout }.from("10").to("15") end end @@ -74,7 +74,7 @@ allow(file_handler).to receive(:read).with(file_path) .and_return("# Some comment\ntimeout 5") subject.load - subject.menue_timeout = timeout + subject.menu_timeout = timeout end it "writes changes to configuration file" do diff --git a/test/systemdboot_test.rb b/test/systemdboot_test.rb index f346bdc93..fc755c056 100644 --- a/test/systemdboot_test.rb +++ b/test/systemdboot_test.rb @@ -45,7 +45,7 @@ allow(Yast::Stage).to receive(:initial).and_return(true) allow(Yast::Installation).to receive(:destdir).and_return(destdir) subject.kernel_params.replace(cmdline_content) - subject.menue_timeout = 10 + subject.menu_timeout = 10 end it "installs the bootloader" do @@ -74,25 +74,25 @@ expect(subject.kernel_params.serialize).to include cmdline_content end - it "creates menue entries" do + it "creates menu entries" do allow(Yast::Execute).to receive(:on_target!) .with("/usr/bin/sdbootutil", "--verbose", "install") allow_any_instance_of(CFA::SystemdBoot).to receive(:save) - # create menue entries + # create menu entries expect(Yast::Execute).to receive(:on_target!) .with("/usr/bin/sdbootutil", "--verbose", "add-all-kernels") subject.write end - it "saves menue timeout" do + it "saves menu timeout" do allow(Yast::Execute).to receive(:on_target!) .with("/usr/bin/sdbootutil", "--verbose", "install") allow(Yast::Execute).to receive(:on_target!) .with("/usr/bin/sdbootutil", "--verbose", "add-all-kernels") - # Saving menue timeout + # Saving menu timeout expect_any_instance_of(CFA::SystemdBoot).to receive(:save) subject.write @@ -121,21 +121,21 @@ end describe "#merge" do - it "overwrite secure boot, mitigations and menue timeout if specified in merged one" do + it "overwrite secure boot, mitigations and menu timeout if specified in merged one" do other_cmdline = "splash=silent quiet mitigations=auto" other = described_class.new other.secure_boot = true - other.menue_timeout = 12 + other.menu_timeout = 12 other.kernel_params.replace(other_cmdline) subject.secure_boot = false - subject.menue_timeout = 10 + subject.menu_timeout = 10 subject.kernel_params.replace(cmdline_content) subject.merge(other) expect(subject.secure_boot).to eq true - expect(subject.menue_timeout).to eq 12 + expect(subject.menu_timeout).to eq 12 expect(subject.cpu_mitigations.to_human_string).to eq "Auto" expect(subject.kernel_params.serialize).to include "security=apparmor splash=silent quiet mitigations=auto" end @@ -147,7 +147,7 @@ .with("globals", "boot_timeout").and_return(2) subject.propose - expect(subject.menue_timeout).to eq 2 + expect(subject.menu_timeout).to eq 2 end it "proposes secure boot" do diff --git a/test/systemdboot_widgets_test.rb b/test/systemdboot_widgets_test.rb index 24333cbeb..8fc6d6ba7 100644 --- a/test/systemdboot_widgets_test.rb +++ b/test/systemdboot_widgets_test.rb @@ -58,7 +58,7 @@ def stub_widget_value(id, value) it "sets timeout to -1 for using menu-force" do subject.store - expect(bootloader.menue_timeout).to eq(-1) + expect(bootloader.menu_timeout).to eq(-1) end end end