source: CMT/v1r20p20081118/mgr/cmt_linux_version.sh

Last change on this file was 465, checked in by rybkin, 16 years ago

See C.L. 366

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.4 KB
Line 
1
2# Determine the Linux distribution and version that is being run.
3#
4
5export LC_ALL=C
6# Check for GNU/Linux distributions
7if [ -f /etc/SuSE-release ]; then
8    DISTRIBUTION="suse"
9    VERSION=`sed  -n '/VERSION/{s#[^0-9]##gp;q}' /etc/SuSE-release`
10elif [ -f /etc/UnitedLinux-release ]; then
11    DISTRIBUTION="united"
12    VERSION=`cat /etc/UnitedLinux-release`
13elif [ -f /etc/debian_version ]; then
14    DISTRIBUTION="debian"
15    VERSION=`cat /etc/debian_version`
16    if [ ${VERSION} = "testing/unstable" ]; then
17        # The debian testing/unstable version must be translated into
18        # a numeric version number, but no number makes sense so just
19        # remove the version all together.
20        VERSION=""
21    fi
22elif [ -f /etc/redhat-release ]; then
23    read a </etc/redhat-release
24    case "$a" in
25        Red*Hat*Enterprise*Linux*)
26            DISTRIBUTION=rhel
27            ;;
28        Red*Hat*Linux*)
29            DISTRIBUTION=rh
30            ;;
31        CERN*E*Linux*)
32            DISTRIBUTION=cel
33            ;;
34        Scientific*Linux*)
35            DISTRIBUTION=slc
36            ;;
37#       Scientific*Linux*CERN*)
38        *)
39            DISTRIBUTION=slc
40            ;;
41    esac
42    VERSION=""
43    while [ -n "$a" ]; do
44        t="${a#?}"              # all but first char of $a
45        c=${a%"${t}"}           # first char of $a
46        a="${t}"                # remove first char from $a
47        case "$c" in
48            [0-9])
49            VERSION="${VERSION}${c}"
50            ;;
51        esac
52    done
53    case "$VERSION" in
54        70|71|72)
55            VERSION=73
56            ;;
57    esac
58else
59    DISTRIBUTION="unknown"
60    VERSION='00'
61fi
62
63echo ${DISTRIBUTION}${VERSION}
Note: See TracBrowser for help on using the repository browser.