Skip to content

Commit

Permalink
writing /etc/kernel/cmdline before calling sdbootutil
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed May 3, 2024
1 parent d5388e6 commit aede79b
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/lib/bootloader/systemdboot.rb
Expand Up @@ -114,13 +114,11 @@ def write(etc_only: false)
log.info("Writing settings...")
if Yast::Stage.initial # while new installation only (currently)
install_bootloader
create_menue_entries
end

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

Expand Down Expand Up @@ -205,17 +203,11 @@ 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=<device>" 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}")
end
# writing kernel parameter to /etc/kernel/cmdline
File.open(File.join(Yast::Installation.destdir, CMDLINE), "w+") do |fw|
fw.puts("root=#{Yast::BootStorage.root_partitions.first.name} #{kernel_params.serialize}")
end

begin
Yast::Execute.on_target!(SDBOOTUTIL, "--verbose", "add-all-kernels")
rescue Cheetah::ExecutionFailed => e
Expand All @@ -227,7 +219,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
Expand Down

0 comments on commit aede79b

Please sign in to comment.