blob: bda8ba3efbf6ef9e1ccc8868076f2a933ccefc2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
require 'facter/lsb'
Facter.add(:operatingsystem) do
confine :kernel => :sunos
setcode do "Solaris" end
end
Facter.add(:operatingsystem) do
confine :kernel => :linux
setcode do
if Facter.value(:lsbdistid) == "Ubuntu"
"Ubuntu"
elsif FileTest.exists?("/etc/debian_version")
"Debian"
elsif FileTest.exists?("/etc/gentoo-release")
"Gentoo"
elsif FileTest.exists?("/etc/fedora-release")
"Fedora"
elsif FileTest.exists?("/etc/mandriva-release")
"Mandriva"
elsif FileTest.exists?("/etc/mandrake-release")
"Mandrake"
elsif FileTest.exists?("/etc/meego-release")
"MeeGo"
elsif FileTest.exists?("/etc/arch-release")
"Archlinux"
elsif FileTest.exists?("/etc/enterprise-release")
if FileTest.exists?("/etc/ovs-release")
"OVS"
else
"OEL"
end
elsif FileTest.exists?("/etc/arch-release")
"Arch"
elsif FileTest.exists?("/etc/redhat-release")
txt = File.read("/etc/redhat-release")
if txt =~ /centos/i
"CentOS"
elsif txt =~ /scientific/i
"Scientific"
else
"RedHat"
end
elsif FileTest.exists?("/etc/SuSE-release")
txt = File.read("/etc/SuSE-release")
if txt =~ /^SUSE LINUX Enterprise Server/i
"SLES"
elsif txt =~ /^SUSE LINUX Enterprise Desktop/i
"SLED"
elsif txt =~ /^openSUSE/i
"OpenSuSE"
else
"SuSE"
end
elsif FileTest.exists?("/etc/slackware-version")
"Slackware"
end
end
end
Facter.add(:operatingsystem) do
# Default to just returning the kernel as the operating system
setcode do Facter[:kernel].value end
end
|