Style changes and improved detection of Red Hat based clones

This commit is contained in:
Michael Boelen 2016-09-27 11:20:35 +02:00
parent 9caf3005b5
commit f0cfab3f04

View File

@ -37,7 +37,7 @@
SYSCTL_READKEY="" SYSCTL_READKEY=""
;; ;;
# Mac OS X # Mac OS X and macOS
Darwin) Darwin)
OS="MacOS" OS="MacOS"
if [ -x /usr/bin/sw_vers ]; then if [ -x /usr/bin/sw_vers ]; then
@ -45,7 +45,7 @@
OS_VERSION=$(/usr/bin/sw_vers -productVersion) OS_VERSION=$(/usr/bin/sw_vers -productVersion)
OS_FULLNAME="${OS_NAME} ${OS_VERSION}" OS_FULLNAME="${OS_NAME} ${OS_VERSION}"
else else
# Fall back to pretty safe name # Fall back to a fairly safe name
OS_NAME="Mac OS X" OS_NAME="Mac OS X"
OS_FULLNAME=$(uname -s -r) OS_FULLNAME=$(uname -s -r)
OS_VERSION=$(uname -r) OS_VERSION=$(uname -r)
@ -150,6 +150,7 @@
OS_FULLNAME="Debian ${OS_VERSION}" OS_FULLNAME="Debian ${OS_VERSION}"
LINUX_VERSION="Debian" LINUX_VERSION="Debian"
fi fi
# /etc/lsb-release does not exist on Debian # /etc/lsb-release does not exist on Debian
if [ -e "/etc/debian_version" -a -e /etc/lsb-release ]; then if [ -e "/etc/debian_version" -a -e /etc/lsb-release ]; then
OS_VERSION=$(cat /etc/debian_version) OS_VERSION=$(cat /etc/debian_version)
@ -169,8 +170,10 @@
fi fi
# Ubuntu test (optional) $(grep "[Uu]buntu" /proc/version) # Ubuntu test (optional) $(grep "[Uu]buntu" /proc/version)
fi fi
# E-smith # E-smith
if [ -e "/etc/e-smith-release" ]; then OS_FULLNAME=$(cat /etc/e-smith-release); fi if [ -e "/etc/e-smith-release" ]; then OS_FULLNAME=$(cat /etc/e-smith-release); fi
# Gentoo # Gentoo
if [ -e "/etc/gentoo-release" ]; then LINUX_VERSION="Gentoo"; OS_FULLNAME=$(cat /etc/gentoo-release); fi if [ -e "/etc/gentoo-release" ]; then LINUX_VERSION="Gentoo"; OS_FULLNAME=$(cat /etc/gentoo-release); fi
@ -238,6 +241,15 @@
fi fi
fi fi
# Scientific
FIND=$(grep "Scientific" /etc/redhat-release)
if [ ! "${FIND}" = "" ]; then
OS_FULLNAME=$(grep "^Scientific" /etc/redhat-release)
OS_VERSION=$(grep "^Scientific" /etc/redhat-release | awk '{ if ($3=="release") { print $4 } }')
LINUX_VERSION="Scientific"
fi
if [ -z "${LINUX_VERSION}" ]; then
# Red Hat # Red Hat
FIND=$(grep "Red Hat" /etc/redhat-release) FIND=$(grep "Red Hat" /etc/redhat-release)
if [ ! "${FIND}" = "" ]; then if [ ! "${FIND}" = "" ]; then
@ -245,13 +257,6 @@
OS_VERSION="${OS_FULLNAME}" OS_VERSION="${OS_FULLNAME}"
LINUX_VERSION="Red Hat" LINUX_VERSION="Red Hat"
fi fi
# Scientific
FIND=$(grep "Scientific" /etc/redhat-release)
if [ ! "${FIND}" = "" ]; then
OS_FULLNAME=$(grep "^Scientific" /etc/redhat-release)
OS_VERSION=$(grep "^Scientific" /etc/redhat-release | awk '{ if ($3=="release") { print $4 } }')
LINUX_VERSION="Scientific"
fi fi
fi fi
@ -318,7 +323,6 @@
# If Linux version (full name) is unknown, use uname value # If Linux version (full name) is unknown, use uname value
if [ "${OS_FULLNAME}" = "" ]; then OS_FULLNAME=$(uname -s -r); fi if [ "${OS_FULLNAME}" = "" ]; then OS_FULLNAME=$(uname -s -r); fi
SYSCTL_READKEY="sysctl -n" SYSCTL_READKEY="sysctl -n"
;; ;;
# NetBSD # NetBSD