blob: ef7b1bc2e7d6ca98a71be68334ffdfe46dddf8ee (
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
65
|
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 OpsCode, Inc.
# License:: GNU GPL, Version 3
#
# Copyright (C) 2008, OpsCode Inc.
#
# Portions of this file benifited greatly from Facter
# (http://reductivelabs.com/projects/facter/)
#
# 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, either version 3 of the License, or
# (at your option) any later version.
#
# 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, see <http://www.gnu.org/licenses/>.
#
require_plugin 'kernel'
require_plugin 'lsb'
if kernel == "SunOS"
os "Solaris"
elsif kernel == "Linux"
if lsb_dist_id == "Ubuntu"
os "Ubuntu"
os_release from_with_regex('cat /etc/issue', /Ubuntu (\d+.\d+)/)
elsif FileTest.exists?("/etc/debian_version")
os "Debian"
os_release from_with_regex('cat /proc/version', /\(Debian (\d+.\d+).\d+-\d+\)/)
elsif FileTest.exists?("/etc/gentoo-release")
os "Gentoo"
elsif FileTest.exists?("/etc/fedora-release")
os "Fedora"
os_release from_with_regex("cat /etc/fedora-release", /\((Rawhide)\)/, /release (\d+)/)
elsif FileTest.exists?("/etc/mandriva-release")
os "Mandriva"
elsif FileTest.exists?("/etc/mandrake-release")
os "Mandrake"
elsif FileTest.exists?("/etc/redhat-release")
txt = File.read("/etc/redhat-release")
if txt =~ /centos/i
os "CentOS"
os_release from_with_regex("rpm -q centos-release", /release-(\d+)/)
else
os "RedHat"
if txt =~ /\(Rawhide\)$/
os_release "Rawhide"
elsif txt =~ /release (\d+)/
os_release $1
end
end
elsif FileTest.exists?("/etc/SuSE-release")
os "SuSE"
end
else
os kernel
os_release kernel_release
end
|