diff --git a/package/yast2-bootloader.changes b/package/yast2-bootloader.changes index 9edde4f58..a52f66536 100644 --- a/package/yast2-bootloader.changes +++ b/package/yast2-bootloader.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri May 3 13:07:26 UTC 2024 - Stefan Schubert + +- Writing "root" entry into /etc/kernel/cmdline which is needed by + sdbootutil. (still for bsc#1220892) +- 5.0.10 + ------------------------------------------------------------------- Fri Apr 26 13:07:51 UTC 2024 - Stefan Schubert diff --git a/package/yast2-bootloader.spec b/package/yast2-bootloader.spec index bf26c4a40..dd23b5ac9 100644 --- a/package/yast2-bootloader.spec +++ b/package/yast2-bootloader.spec @@ -17,7 +17,7 @@ Name: yast2-bootloader -Version: 5.0.9 +Version: 5.0.10 Release: 0 Summary: YaST2 - Bootloader Configuration License: GPL-2.0-or-later diff --git a/src/lib/bootloader/systemdboot.rb b/src/lib/bootloader/systemdboot.rb index 7bbe53fd0..a69a81e8d 100644 --- a/src/lib/bootloader/systemdboot.rb +++ b/src/lib/bootloader/systemdboot.rb @@ -112,15 +112,10 @@ def read def write(etc_only: false) super log.info("Writing settings...") - if Yast::Stage.initial # while new installation only (currently) - install_bootloader - create_menue_entries - end + install_bootloader if Yast::Stage.initial # while new installation only (currently) + create_menue_entries write_menue_timeout - File.open(File.join(Yast::Installation.destdir, CMDLINE), "w+") do |fw| - fw.puts(kernel_params.serialize) - end true end @@ -205,17 +200,15 @@ def write_sysconfig(prewrite: false) SDBOOTUTIL = "/usr/bin/sdbootutil" def create_menue_entries - cmdline_file = File.join(Yast::Installation.destdir, CMDLINE) - if Yast::Stage.initial - # sdbootutil script needs the "root=" entry in kernel parameters. - # This will be written to CMDLINE which will be used in an - # installed system by the administrator only. So we can use it because - # the system will be installed new. This file will be deleted after - # calling sdbootutil. - File.open(cmdline_file, "w+") do |fw| - fw.puts("root=#{Yast::BootStorage.root_partitions.first.name}") + # 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 + fw.puts("root=#{Yast::BootStorage.root_partitions.first.name} #{kernel_params.serialize}") + else # root entry is already available + fw.puts(kernel_params.serialize) end end + begin Yast::Execute.on_target!(SDBOOTUTIL, "--verbose", "add-all-kernels") rescue Cheetah::ExecutionFailed => e @@ -227,7 +220,6 @@ def create_menue_entries ), command: e.commands.inspect, stderr: e.stderr) ) end - File.delete(cmdline_file) if Yast::Stage.initial # see above end def read_menue_timeout diff --git a/test/systemdboot_test.rb b/test/systemdboot_test.rb index c860ffd6c..f346bdc93 100644 --- a/test/systemdboot_test.rb +++ b/test/systemdboot_test.rb @@ -71,7 +71,7 @@ # Checking written kernel parameters subject.read expect(subject.cpu_mitigations.to_human_string).to eq "Off" - expect(subject.kernel_params.serialize).to eq cmdline_content + expect(subject.kernel_params.serialize).to include cmdline_content end it "creates menue entries" do @@ -137,7 +137,7 @@ expect(subject.secure_boot).to eq true expect(subject.menue_timeout).to eq 12 expect(subject.cpu_mitigations.to_human_string).to eq "Auto" - expect(subject.kernel_params.serialize).to eq "security=apparmor splash=silent quiet mitigations=auto" + expect(subject.kernel_params.serialize).to include "security=apparmor splash=silent quiet mitigations=auto" end end