source: CMT/v1r18p20041201/mgr/cmt_linux_version.sh @ 1

Last change on this file since 1 was 1, checked in by arnault, 19 years ago

Import all tags

File size: 1.6 KB
Line 
1
2# Determine the Linux distribution and version that is being run.
3#
4
5# Check for GNU/Linux distributions
6if [ -f /etc/SuSE-release ]; then
7  DISTRIBUTION="suse"
8elif [ -f /etc/UnitedLinux-release ]; then
9  DISTRIBUTION="united"
10elif [ -f /etc/debian_version ]; then
11  DISTRIBUTION="debian"
12elif [ -f /etc/redhat-release ]; then
13  a=`grep -i 'red.*hat.*enterprise.*linux' /etc/redhat-release`
14  if test $? = 0; then
15    DISTRIBUTION=rhel
16  else
17    a=`grep -i 'red.*hat.*linux' /etc/redhat-release`
18    if test $? = 0; then
19      DISTRIBUTION=rh
20    else
21      a=`grep -i 'cern.*e.*linux' /etc/redhat-release`
22      if test $? = 0; then
23        DISTRIBUTION=cel
24      else
25        a=`grep -i 'scientific.*linux' /etc/redhat-release`
26        DISTRIBUTION="slc"
27      fi
28    fi
29  fi
30else
31  DISTRIBUTION="unknown"
32fi
33
34###    VERSION=`rpm -q redhat-release | sed -e 's#redhat[-]release[-]##'`
35
36case ${DISTRIBUTION} in
37rh|cel|rhel|slc)
38    VERSION=`cat /etc/redhat-release | sed -e 's#[^0-9]##g' -e 's#7[0-2]#73#'`
39    ;;
40debian)
41    VERSION=`cat /etc/debian_version`
42    if [ ${VERSION} = "testing/unstable" ]; then
43        # The debian testing/unstable version must be translated into
44        # a numeric version number, but no number makes sense so just
45        # remove the version all together.
46        VERSION=""
47    fi
48    ;;
49suse)
50    VERSION=`cat /etc/SuSE-release | grep 'VERSION' | sed  -e 's#[^0-9]##g'`
51    ;;
52united)
53    VERSION=`cat /etc/UnitedLinux-release`
54    ;;
55*)
56    VERSION='00'
57    ;;
58esac;
59
60echo ${DISTRIBUTION}${VERSION}
Note: See TracBrowser for help on using the repository browser.