3 # This script determines the Linux distribution we are running
4 # on. It output two words: (1) The distro name and (2) the version
5 # Example output "UBUNTU 10.04"
7 # Ubuntu is detected with /etc/lsb-release
9 if [ -e /etc
/lsb-release
]
12 if [ -n "$DISTRIB_ID" -a -n "$DISTRIB_RELEASE" ] ; then
13 echo "${DISTRIB_ID^^*}$SEP$DISTRIB_RELEASE"
18 # Debian: We drop the last version: 5.0.4 -> 5.0
19 if [ -e /etc
/debian_version
]
21 VERSION
=$
(cat /etc
/debian_version
)
22 if [ "${VERSION:3:1}" = .
] ; then
23 VERSION
=${VERSION:0:3}
25 if [ "${VERSION:0:6}" = "wheezy" ] ; then
28 if [ "${VERSION:0:6}" = "jessie" ] ; then
31 echo "DEBIAN$SEP$VERSION"
36 if [ -e /etc
/redhat-release
]
38 # CentOS release 5.4 (Final)
39 VERSION
=$
(cat /etc
/redhat-release
)
40 if [ "${VERSION:0:6}" = CentOS
]
42 if [ "${VERSION:0:24}" = "CentOS Linux release 6.0" ]; then
43 echo "CENTOS${SEP}6.0"
45 elif [ "${VERSION:0:24}" = "CentOS Linux release 7.0" ]; then
46 echo "CENTOS${SEP}7.0"
54 elif [ "${VERSION:0:43}" = "Red Hat Enterprise Linux Server release 6.0" ]
56 echo "REDHAT${SEP}6.0"
58 elif [ "${VERSION:0:43}" = "Red Hat Enterprise Linux Server release 6.1" ]
60 echo "REDHAT${SEP}6.1"
62 elif [ "${VERSION:0:43}" = "Red Hat Enterprise Linux Server release 6.2" ]
64 echo "REDHAT${SEP}6.2"
66 elif [ "${VERSION:0:43}" = "Red Hat Enterprise Linux Server release 6.3" ]
68 echo "REDHAT${SEP}6.3"
70 elif [ "${VERSION:0:43}" = "Red Hat Enterprise Linux Server release 6.4" ]
72 echo "REDHAT${SEP}6.4"
74 elif [ "${VERSION:0:43}" = "Red Hat Enterprise Linux Server release 6.5" ]
76 echo "REDHAT${SEP}6.5"
78 elif [ "${VERSION:0:43}" = "Red Hat Enterprise Linux Server release 7.0" ]
80 echo "REDHAT${SEP}7.0"
86 if [ -e /etc
/SuSE-release
]
89 VERSION
=$
(sed -rn 's/^VERSION = (.*)/\1/p' < /etc
/SuSE-release
)
90 SP
=$
(sed -rn 's/^PATCHLEVEL = (.*)/\1/p' < /etc
/SuSE-release
)
91 if [ "$VERSION" = 11 -a "$SP" = 1 ]
93 echo "SLES$SEP${VERSION}SP1"
95 elif [ "$VERSION" = 11 -a "$SP" = 2 ]
97 echo "SLES$SEP${VERSION}SP2"
99 elif [ "$VERSION" = 10 -a "$SP" = 1 ]
101 echo "SLES$SEP${VERSION}SP1"
103 elif [ "$VERSION" = 11 -a "$SP" = 3 ]
105 echo "SLES$SEP${VERSION}SP3"
107 elif [ "$VERSION" = 10 -a "$SP" = 1 ]
109 echo "SLES$SEP${VERSION}SP1"
111 elif [ "$VERSION" = 10 -a "$SP" = 2 ]
113 echo "SLES$SEP${VERSION}SP2"
115 elif [ "$VERSION" = 11 ]
117 echo "SLES$SEP${VERSION}"
119 elif [ "$VERSION" = 12 ]
121 echo "SLES$SEP${VERSION}"
123 elif [ "$VERSION" = 12.1 ]
125 echo "OPENSUSE$SEP${VERSION}"