From d75744b5bc40d8f26bff72f8b8738fc41b7f8a24 Mon Sep 17 00:00:00 2001 From: luke Date: Wed, 20 Sep 2006 15:46:22 +0000 Subject: Adding patch from #21, adding lsb_release facts git-svn-id: http://reductivelabs.com/svn/facter/trunk@171 1f5c1d6a-bddf-0310-8f58-fc49e503516a --- lib/facter.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/facter.rb b/lib/facter.rb index 8a9fcc1..fd1dd42 100644 --- a/lib/facter.rb +++ b/lib/facter.rb @@ -608,6 +608,21 @@ class Facter setcode 'uname -r' end + {"LSBRelease" => "^LSB Version:\t(.*)$", "LSBDistId" => "^Distributor ID:\t(.*)$", + "LSBDistRelease" => "^Release:\t(.*)$", "LSBDistDescription" => "^Description:\t(.*)$", + "LSBDistCodeName" => "^Codename:\t(.*)$"}.each { |fact, pattern| + output = %x{lsb_release -a 2>&1} + if $? == 0 + Facter.add(fact) do + setcode do + if $? == 0 and output =~ /#{pattern}/ + $1 + end + end + end # end of add + end + } + Facter.add("OperatingSystem") do # Default to just returning the kernel as the operating system setcode do Facter["Kernel"].value end -- cgit