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