Initial commit. It's far from finished.
This commit is contained in:
33
agent/detect-unix.sh
Executable file
33
agent/detect-unix.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# Detects which OS and if it is Linux then it will detect which Linux Distribution.
|
||||
|
||||
OS=$(uname -s)
|
||||
MARCH=$(uname -m)
|
||||
|
||||
if [ "${OS}" = "SunOS" ] ; then
|
||||
OS=Solaris
|
||||
ARCH=$(uname -p)
|
||||
OSSTR="${OS} ${REV}(${ARCH} $(uname -v))"
|
||||
elif [ "${OS}" = "AIX" ] ; then
|
||||
OSSTR="${OS} $(oslevel) ($(oslevel -r))"
|
||||
elif [ "${OS}" = "Linux" ] ; then
|
||||
KERNEL=$(uname -r)
|
||||
if [ -f /etc/redhat-release ] ; then
|
||||
DIST="$(cat /etc/redhat-release)"
|
||||
elif [ -f /etc/SuSE-release ] ; then
|
||||
DIST=$(tr "\n" ' ' < /etc/SuSE-release | sed s/VERSION.*//)
|
||||
elif [ -f /etc/debian_version ] ; then
|
||||
DIST="Debian $(cat /etc/debian_version)"
|
||||
elif [ -f /etc/slackware-version ] ; then
|
||||
DIST="$(cat /etc/slackware-version)"
|
||||
elif [ -f /etc/os-release ] ; then
|
||||
DIST=$(grep PRETTY_NAME /etc/os-release | tr -d '"=' | sed 's/PRETTY_NAME//')
|
||||
else
|
||||
DIST="$OS $MARCH"
|
||||
fi
|
||||
|
||||
OSSTR="${DIST}"
|
||||
fi
|
||||
|
||||
|
||||
printf "%s" "${OSSTR}"
|
||||
Reference in New Issue
Block a user