| 
									
										
										
										
											2007-04-03 14:10:23 +00:00
										 |  |  | #!/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` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-31 10:51:02 +00:00
										 |  |  | 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 | awk '{print $1}') | 
					
						
							|  |  |  |     if [ "${DIST}" = "CentOS" ]; then | 
					
						
							|  |  |  |       DIST="CentOS" | 
					
						
							| 
									
										
										
										
											2012-04-04 17:39:10 +00:00
										 |  |  |     elif [ "${DIST}" = "Mandriva" ]; then | 
					
						
							|  |  |  |       DIST="Mandriva" | 
					
						
							|  |  |  |       PSEUDONAME=`cat /etc/mandriva-release | sed s/.*\(// | sed s/\)//` | 
					
						
							|  |  |  |       REV=`cat /etc/mandriva-release | sed s/.*release\ // | sed s/\ .*//` | 
					
						
							| 
									
										
										
										
											2011-03-31 10:51:02 +00:00
										 |  |  |     else | 
					
						
							|  |  |  |       DIST="RedHat" | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-04 17:39:10 +00:00
										 |  |  |     PSEUDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` | 
					
						
							| 
									
										
										
										
											2011-03-31 10:51:02 +00:00
										 |  |  |     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' | 
					
						
							| 
									
										
										
										
											2012-04-04 17:39:10 +00:00
										 |  |  |     PSEUDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` | 
					
						
							| 
									
										
										
										
											2011-03-31 10:51:02 +00:00
										 |  |  |     REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` | 
					
						
							|  |  |  |   elif [ -f /etc/debian_version ] ; then | 
					
						
							|  |  |  |     DIST="Debian `cat /etc/debian_version`" | 
					
						
							|  |  |  |     REV="" | 
					
						
							| 
									
										
										
										
											2014-03-08 22:32:19 +01:00
										 |  |  |   elif [ -f /etc/gentoo-release ] ; then | 
					
						
							|  |  |  |     DIST="Gentoo" | 
					
						
							|  |  |  |     REV=$(tr -d '[[:alpha:]]' </etc/gentoo-release | tr -d " ") | 
					
						
							| 
									
										
										
										
											2011-03-31 10:51:02 +00:00
										 |  |  |   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 | 
					
						
							|  |  |  |     LSB_DIST="`cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2`" | 
					
						
							|  |  |  |     LSB_REV="`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2`" | 
					
						
							|  |  |  |     if [ "$LSB_DIST" != "" ] ; then | 
					
						
							|  |  |  |       DIST=$LSB_DIST | 
					
						
							|  |  |  |       REV=$LSB_REV | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  |   fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-04 17:39:10 +00:00
										 |  |  | #  OSSTR="${OS} ${DIST} ${REV}(${PSEUDONAME} ${KERNEL} ${MACH})" | 
					
						
							| 
									
										
										
										
											2011-03-31 10:51:02 +00:00
										 |  |  |   OSSTR="${DIST} ${REV}" | 
					
						
							|  |  |  | elif [ "${OS}" = "Darwin" ] ; then | 
					
						
							|  |  |  |   if [ -f /usr/bin/sw_vers ] ; then | 
					
						
							|  |  |  |     OSSTR=`/usr/bin/sw_vers|grep -v Build|sed 's/^.*:.//'| tr "\n" ' '` | 
					
						
							|  |  |  |   fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo ${OSSTR} |