From f3883f13d3df36389112f3f33d438f36a2c347e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 5 Nov 2021 16:25:36 +0100 Subject: Setup syslinux. --- modules/syslinux/lib/facter/efibootmgr.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 modules/syslinux/lib/facter/efibootmgr.rb (limited to 'modules/syslinux/lib/facter/efibootmgr.rb') diff --git a/modules/syslinux/lib/facter/efibootmgr.rb b/modules/syslinux/lib/facter/efibootmgr.rb new file mode 100644 index 0000000..fdf95e0 --- /dev/null +++ b/modules/syslinux/lib/facter/efibootmgr.rb @@ -0,0 +1,19 @@ +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] + end + end + out['boots'] = boots + out + end +end -- cgit v1.2.3