mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 16:08:55 +02:00
Initial Import
git-svn-id: http://www.observium.org/svn/observer/trunk@2 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
# Detects which OS and if it is Linux then it will detect which Linux Distribution.
|
||||
|
||||
OS=`uname -s`
|
||||
REV=`uname -r`
|
||||
MACH=`uname -m`
|
||||
|
||||
GetVersionFromFile()
|
||||
{
|
||||
VERSION=`cat $1 | tr "\n" ' ' | sed s/.*VERSION.*=\ // `
|
||||
}
|
||||
|
||||
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='RedHat'
|
||||
PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
|
||||
REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
|
||||
elif [ -f /etc/SuSE-release ] ; then
|
||||
DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
|
||||
REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
|
||||
elif [ -f /etc/mandrake-release ] ; then
|
||||
DIST='Mandrake'
|
||||
PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
|
||||
REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
|
||||
elif [ -f /etc/debian_version ] ; then
|
||||
DIST="Debian `cat /etc/debian_version`"
|
||||
REV=""
|
||||
fi
|
||||
if [ -f /etc/UnitedLinux-release ] ; then
|
||||
DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
|
||||
fi
|
||||
if [ -f /etc/lsb-release ] ; then
|
||||
DIST="`cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2`"
|
||||
REV="`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2`"
|
||||
fi
|
||||
# OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})"
|
||||
OSSTR="${DIST} ${REV}"
|
||||
fi
|
||||
echo ${OSSTR}
|
||||
|
||||
Reference in New Issue
Block a user