source: CMT/v1r20p20080222/mgr/cmt_linux_version.sh @ 597

Last change on this file since 597 was 432, checked in by rybkin, 16 years ago

See C.L. 338

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