summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-03 22:15:39 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-03 22:21:50 +0100
commit08fd6d85b82e110a8033016613c62d609c9ba8c1 (patch)
tree822dd5fafd52bb9c215151918275eb850d071179
parentRework syslinux. (diff)
downloadsyslinux-08fd6d85b82e110a8033016613c62d609c9ba8c1.tar.gz
syslinux-08fd6d85b82e110a8033016613c62d609c9ba8c1.tar.xz
stuff
-rw-r--r--lib/facter/efibootmgr.rb30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/facter/efibootmgr.rb b/lib/facter/efibootmgr.rb
index fdf95e0..f4a03f4 100644
--- a/lib/facter/efibootmgr.rb
+++ b/lib/facter/efibootmgr.rb
@@ -1,19 +1,21 @@
-Facter.add('efi') do
- setcode do
- out = {}
- data = Facter::Core::Execution.execute('efibootmgr')
- boots = {}
- data.split("\n").each do |item|
- if a = item.match(/BootOrder: (.*)/) then
- out['BootOrder'] = a[1].split(',')
- elsif a = item.match(/(\w*): (.*)/) then
+if Facter::Core::Execution.which('efibootmgr') do
+ Facter.add('efi') do
+ setcode do
+ out = {}
+ data = Facter::Core::Execution.execute('efibootmgr')
+ boots = {}
+ data.split("\n").each do |item|
+ if a = item.match(/BootOrder: (.*)/) then
+ out['BootOrder'] = a[1].split(',')
+ elsif a = item.match(/(\w*): (.*)/) then
out[a[1]] = a[2]
- elsif a = item.match(/Boot(\d*)(\*?) (.*)/)
- # a[2] contains if it's active
- boots[a[1]] = a[3]
+ elsif a = item.match(/Boot(\d*)(\*?) (.*)/)
+ # a[2] contains if it's active
+ boots[a[1]] = a[3]
+ end
end
+ out['boots'] = boots
+ out
end
- out['boots'] = boots
- out
end
end