Merge pull request #1071 from Varbin/opensolaris-detection

OpenSolaris distribution detection
This commit is contained in:
Michael Boelen 2020-11-13 16:01:00 +01:00 committed by GitHub
commit eb759f4c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 97 additions and 4 deletions

View File

@ -237,4 +237,20 @@ os:Ubuntu 18.10:2019-07-18:1563400800:
os:Ubuntu 19.04:2020-01-01:1577833200: os:Ubuntu 19.04:2020-01-01:1577833200:
os:Ubuntu 20.04:2025-04-01:1743458400: os:Ubuntu 20.04:2025-04-01:1743458400:
# #
# OmniosCE - https://omniosce.org/releasenotes.html
#
os:OmniOS Community Edition v11 r151022:2020-05-11:1589148000:
os:OmniOS Community Edition v11 r151024:2018-11-04:1541286000:
os:OmniOS Community Edition v11 r151026:2019-05-05:1557007200:
os:OmniOS Community Edition v11 r151028:2019-11-04:1572822000:
os:OmniOS Community Edition v11 r151030::-1:
os:OmniOS Community Edition v11 r151032:2020-11-03:1604358000:
os:OmniOS Community Edition v11 r151034::-1:
#
## Oracle Solaris - https://www.oracle.com/us/support/library/lifetime-support-hardware-301321.pdf (p. 34)
# The list below contains Premier Support End only
#
os:Oracle Solaris 11.3:2021-01-01:1609455600:
os:Oracle Solaris 11.4:2031-11-01:1951254000:
#
# EOF # EOF

View File

@ -567,12 +567,89 @@
SYSCTL_READKEY="" SYSCTL_READKEY=""
;; ;;
# Solaris / OpenSolaris # Solaris / OpenSolaris / Ilumos ...
SunOS) SunOS)
OS="Solaris" OS="Solaris"
OS_KERNELVERSION=$(uname -v)
OPENSOLARIS=0
if [ -f /etc/os-release ]; then
OS_ID=$(grep "^ID=" /etc/os-release | awk -F= '{print $2}' | tr -d '"')
OS_VERSION=$(grep "^VERSION=" /etc/os-release | awk -F= '{print $2}' | tr -d '"')
OS_FULLNAME=$(awk -F= '/^PRETTY_NAME=/ {print substr($2,2,length($2)-2)}' /etc/os-release)
case "${OS_ID}" in
"solaris")
OS_NAME="Oracle Solaris"
;;
"omnios")
OS_NAME="OmniOS"
OPENSOLARIS=1
;;
"tribblix")
OS_NAME="Tribblix"
OS_FULLNAME="Tribblix ${OS_VERSION}"
OPENSOLARIS=1
;;
"*")
ReportException "OS Detection" "Unknown OS found in /etc/os-release - Please create issue on GitHub project page: ${PROGRAM_SOURCE}"
;;
esac
elif [ "$(uname -o 2> /dev/null)" == "illumos" ]; then
OPENSOLARIS=1
# Solaris has a free form text file with release information
if grep "OpenIndiana" /etc/release > /dev/null; then
OS_NAME="OpenIndiana"
if grep "Hipster" /etc/release > /dev/null; then
OS_VERSION="$(tr ' ' '\n' < /etc/release | grep '[[:digit:]]\.[[:digit:]]')"
OS_FULLNAME="OpenIndiana Hipster $OS_VERSION"
else
OS_VERSION="Unknown"
OS_FULLNAME="OpenIndiana (unknown edition)"
fi
elif grep "OmniOS" /etc/release > /dev/null; then
OS_NAME="OmniOS"
OS_VERSION="$(tr ' ' '\n' < /etc/release | grep 'r[[:digit:]]')"
if grep "Community Edition" /etc/release > /dev/null; then
OS_FULLNAME="OmniOS Community Edition v11 $OS_VERSION"
fi
elif grep "SmartOS" /etc/release > /dev/null; then
OS_NAME="SmartOS"
OS_VERSION="-"
OS_FULLNAME="SmartOS"
else
OS_NAME="Unknown Illumos"
fi
elif grep "SchilliX" /etc/release > /dev/null; then
OS_NAME="SchilliX"
OS_FULLNAME="$(head -n 1 /etc/release | xargs)"
OS_VERSION="$(echo "$OS_FULLNAME" | cut -d '-' -f 2)"
OPENSOLARIS=1
elif head -n 1 < /etc/release | grep "Oracle Solaris" > /dev/null; then
OS_NAME="Oracle Solaris"
OS_FULLNAME="$(head -n 1 /etc/release | xargs)"
OS_VERSION="$(head -n 1 < /etc/release | xargs | cut -d ' ' -f 3)"
elif head -n 1 < /etc/release | xargs | grep "^Solaris " > /dev/null; then
OS_NAME="Sun Solaris"
# Example of /etc/release:
# Solaris 10 5/08
# ...
# Solaris 10 10/09 (Update 8)
# The first line does not contain the "Update" number,
# only if present.
if tail -1 < /etc/release | xargs | grep "^Solaris " > /dev/null; then
OS_FULLNAME=$(tail -1 < /etc/release | xargs)
else
OS_FULLNAME=$(head -1 < /etc/release | xargs)
fi
OS_VERSION=$(echo "$OS_FULLNAME" | cut -d ' ' -f 2,3)
else # Old behaviour
OS_NAME="Sun Solaris" OS_NAME="Sun Solaris"
OS_FULLNAME=$(uname -s -r) OS_FULLNAME=$(uname -s -r)
OS_VERSION=$(uname -r) OS_VERSION=$(uname -r)
fi
HARDWARE=$(uname -m) HARDWARE=$(uname -m)
if [ -x /usr/bin/isainfo ]; then if [ -x /usr/bin/isainfo ]; then
# Returns 32, 64 # Returns 32, 64