Files
rmps/agent/detect-unix.sh

34 lines
896 B
Bash
Executable File

#!/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}"