~gandelman-a/ubuntu/precise/facter/merge922788

« back to all changes in this revision

Viewing changes to lib/facter/operatingsystem.rb

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2011-10-18 10:32:42 UTC
  • mfrom: (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20111018103242-ag8i8vejfp8v7b1b
Tags: upstream-1.6.1
ImportĀ upstreamĀ versionĀ 1.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Fact: operatingsystem
 
2
#
 
3
# Purpose: Return the name of the operating system.
 
4
#
 
5
# Resolution:
 
6
#   If the kernel is a Linux kernel, check for the existence of a selection of
 
7
#   files in /etc/ to find the specific flavour.
 
8
#   On SunOS based kernels, return Solaris.
 
9
#   On systems other than Linux, use the kernel value.
 
10
#
 
11
# Caveats:
 
12
#
 
13
 
1
14
require 'facter/lsb'
2
15
 
3
16
Facter.add(:operatingsystem) do
24
37
            "MeeGo"
25
38
        elsif FileTest.exists?("/etc/arch-release")
26
39
            "Archlinux"
 
40
        elsif FileTest.exists?("/etc/oracle-release")
 
41
            "OracleLinux"
27
42
        elsif FileTest.exists?("/etc/enterprise-release")
28
43
            if FileTest.exists?("/etc/ovs-release")
29
44
                "OVS"
38
53
            txt = File.read("/etc/redhat-release")
39
54
            if txt =~ /centos/i
40
55
                "CentOS"
 
56
            elsif txt =~ /CERN/
 
57
                "SLC"
41
58
            elsif txt =~ /scientific/i 
42
59
                "Scientific"
43
60
            else
60
77
            "Slamd64"
61
78
        elsif FileTest.exists?("/etc/slackware-version")
62
79
            "Slackware"
 
80
        elsif FileTest.exists?("/etc/alpine-release")
 
81
            "Alpine"
63
82
        end
64
83
    end
65
84
end