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 two versions: 5.0.4 -> 5
19 if [ -e /etc
/debian_version
]
21 VERSION
=$
(cat /etc
/debian_version
)
22 if [ "${VERSION:1:1}" = .
] ; then
23 VERSION
=${VERSION:0:1}
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
45 elif [ "${VERSION:0:22}" = "CentOS Linux release 7" ]; then
49 echo "CENTOS$SEP${VERSION:15:1}"
51 elif [ "${VERSION:0:24}" = "Red Hat Enterprise Linux" ]
53 echo "REDHAT$SEP${VERSION:40:1}"
55 elif [ "${VERSION:0:6}" = "Fedora" ]
57 [[ $VERSION =~
(Fedora release
([0-9]+)) ]] && REL
=${BASH_REMATCH[2]} ||
exit 0
64 if [ -e /etc
/SuSE-release
]
67 VERSION
=$
(sed -rn 's/^VERSION = (.*)/\1/p' < /etc
/SuSE-release
)
68 SP
=$
(sed -rn 's/^PATCHLEVEL = (.*)/\1/p' < /etc
/SuSE-release
)
69 if [ "$VERSION" = 11 -a "$SP" = 1 ]
71 echo "SLES$SEP${VERSION}SP1"
73 elif [ "$VERSION" = 11 -a "$SP" = 2 ]
75 echo "SLES$SEP${VERSION}SP2"
77 elif [ "$VERSION" = 11 -a "$SP" = 3 ]
79 echo "SLES$SEP${VERSION}SP3"
81 elif [ "$VERSION" = 11 -a "$SP" = 4 ]
83 echo "SLES$SEP${VERSION}SP4"
85 elif [ "$VERSION" = 10 -a "$SP" = 1 ]
87 echo "SLES$SEP${VERSION}SP1"
89 elif [ "$VERSION" = 10 -a "$SP" = 2 ]
91 echo "SLES$SEP${VERSION}SP2"
93 elif [ "$VERSION" = 11 ]
95 echo "SLES$SEP${VERSION}"
97 elif [ "$VERSION" = 12 ]
99 echo -n "SLES$SEP${VERSION}"
100 if [ $SP != 0 ]; then
106 elif [ "$VERSION" = 12.1 ]
108 echo "OPENSUSE$SEP${VERSION}"