diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-11-05 16:25:36 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-03 18:55:01 +0100 |
commit | f3883f13d3df36389112f3f33d438f36a2c347e2 (patch) | |
tree | c2794a13a7009a354456b7e957deedb91ea76b98 /modules/syslinux/lib/facter/partid.rb | |
parent | Manage global hiera. (diff) | |
download | webdav_server-f3883f13d3df36389112f3f33d438f36a2c347e2.tar.gz webdav_server-f3883f13d3df36389112f3f33d438f36a2c347e2.tar.xz |
Setup syslinux.
Diffstat (limited to '')
-rw-r--r-- | modules/syslinux/lib/facter/partid.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/syslinux/lib/facter/partid.rb b/modules/syslinux/lib/facter/partid.rb new file mode 100644 index 0000000..53fc37c --- /dev/null +++ b/modules/syslinux/lib/facter/partid.rb @@ -0,0 +1,16 @@ +Facter.add('partinfo') do + setcode do + obj = {} + Dir.entries('/sys/class/block/').each do |entry| + if entry == '.' or entry == '..' then next end + path = "/sys/class/block/#{entry}/partition" + if File.file?(path) then + obj[entry] = { + 'partid' => File.read(path).strip(), + 'device' => File.basename(File.dirname(File.readlink("/sys/class/block/#{entry}"))), + } + end + end + obj + end +end |