diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-02-08 16:15:02 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-02-08 16:15:02 +1100 |
commit | a633aebab4dc4d07119a619c21cad6a719552083 (patch) | |
tree | ad04c5340b523ba6866d1947e92a220699c8aa2c /lib/facter/kernel.rb | |
parent | c312df8f1c09513b93d559147c6dc3f18e0e45df (diff) | |
download | facter-a633aebab4dc4d07119a619c21cad6a719552083.tar.gz facter-a633aebab4dc4d07119a619c21cad6a719552083.tar.xz facter-a633aebab4dc4d07119a619c21cad6a719552083.zip |
Added new files
Diffstat (limited to 'lib/facter/kernel.rb')
-rw-r--r-- | lib/facter/kernel.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/facter/kernel.rb b/lib/facter/kernel.rb new file mode 100644 index 0000000..68f887a --- /dev/null +++ b/lib/facter/kernel.rb @@ -0,0 +1,46 @@ +## kernel.rb +## Facts related to the kernel, architecture and related +## +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License +## as published by the Free Software Foundation (version 2 of the License) +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA +## + + Facter.add(:kernel) do + setcode 'uname -s' + end + + Facter.add(:kernelrelease) do + setcode 'uname -r' + end + + Facter.add(:hardwaremodel) do + setcode 'uname -m' + end + + Facter.add(:architecture) do + confine :kernel => :linux + setcode do + model = Facter.value(:hardwaremodel) + case model + # most linuxen use "x86_64" + when 'x86_64': + Facter.value(:operatingsystem) == "Debian" ? "amd64" : model; + when /(i[3456]86|pentium)/: "i386" + else + model + end + end + end + + Facter.add(:hardwareisa) do + setcode 'uname -p', '/bin/sh' + confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE Debian Gentoo FreeBSD OpenBSD NetBSD} + end |