Skip to content

Commit

Permalink
set timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Apr 21, 2023
1 parent c217153 commit 73f6270
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/lib/bootloader/grub2base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ def write(etc_only: false)
@password.write
return if etc_only

#reset eventl. already installed systemd bootloader
systemd-boot = BootloaderFactory.bootloader_by_name("systemd-boot")
systemd-boot.delete if systemd-boot
# reset eventl. already installed systemd bootloader
systemd_boot = BootloaderFactory.bootloader_by_name("systemd-boot")
systemd_boot.delete if systemd_boot

Yast::Execute.on_target("/usr/sbin/grub2-mkconfig", "-o", "/boot/grub2/grub.cfg",
env: systemwide_locale)
Expand Down
24 changes: 21 additions & 3 deletions src/lib/bootloader/systemdboot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ module Bootloader
# Represents systemd bootloader with efi target
class SystemdBoot < BootloaderBase
include Yast::Logger
include Yast::I18n

include Yast::I18n

# @!attribute timeout
# @return [Integer] menue timeout
attr_accessor :timeout

def initialize
super

textdomain "bootloader"
self.timeout = 10
end

# Write bootloader settings to disk
Expand Down Expand Up @@ -69,7 +74,7 @@ def name

def delete
delete_bootloader
end
end

# overwrite BootloaderBase version to save secure boot
# def write_sysconfig(prewrite: false)
Expand Down Expand Up @@ -164,6 +169,19 @@ def install_bootloader
), command: e.commands.inspect, stderr: e.stderr))
return
end

# Set menue timeout.
begin
Yast::Execute.on_target!(BOOTCTL, "set-timeout", self.timeout)
rescue Cheetah::ExecutionFailed => e
Yast::Report.Error(
format(_(
"Cannot set menue timeout:\n" \
"Command `%{command}`.\n" \
"Error output: %{stderr}"
), command: e.commands.inspect, stderr: e.stderr))
return
end
end
end
end

0 comments on commit 73f6270

Please sign in to comment.