Skip to content

Commit

Permalink
read default time settings
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Apr 25, 2023
1 parent 9816634 commit df5f99e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/lib/bootloader/systemdboot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def initialize
def read
super

read_timeout()
self.secure_boot = Systeminfo.secure_boot_active?
end

Expand Down Expand Up @@ -93,6 +94,8 @@ def delete
LS = "/bin/ls".freeze
KERNELINSTALL = "/usr/bin/kernel-install".freeze
BOOTCTL = "/bin/bootctl".freeze
CAT = "/bin/cat".freeze
TIMEOUTFILE="/sys/firmware/efi/efivars/LoaderConfigTimeout-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f".freeze

def create_menue_entries
Dir.foreach('/usr/lib/modules') do |kernel_name|
Expand All @@ -110,11 +113,22 @@ def create_menue_entries
"Error output: %{stderr}"
), command: e.commands.inspect, stderr: e.stderr))
return
end
end
end
end
end

def read_timeout
if File.file?(TIMEOUTFILE)
data = "".dup
read_bytes = File.read(TIMEOUTFILE)
read_bytes.each_byte do |c|
data << c.chr if c >=48 && c <=57
end
self.timeout = data.to_i
end
end

def bootloader_is_installed
Yast::Execute.on_target(BOOTCTL, "is-installed", allowed_exitstatus: 1) == 0
end
Expand Down

0 comments on commit df5f99e

Please sign in to comment.