source: CMT/v1r14p20031120/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.1 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  DISTRIBUTION="rh"
14else
15  DISTRIBUTION="unknown"
16fi
17
18###    VERSION=`rpm -q redhat-release | sed -e 's#redhat[-]release[-]##'`
19
20case ${DISTRIBUTION} in
21rh)
22    VERSION=`cat /etc/redhat-release | sed -e 's#[^0-9]##g' -e 's#7[0-2]#73#'`
23    ;;
24debian)
25    VERSION=`cat /etc/debian_version`
26    if [ ${VERSION} = "testing/unstable" ]; then
27        # The debian testing/unstable version must be translated into
28        # a numeric version number, but no number makes sense so just
29        # remove the version all together.
30        VERSION=""
31    fi
32    ;;
33suse)
34    VERSION=`cat /etc/SuSE-release | grep 'VERSION' | sed  -e 's#[^0-9]##g'`
35    ;;
36united)
37    VERSION=`cat /etc/UnitedLinux-release`
38    ;;
39*)
40    VERSION='00'
41    ;;
42esac;
43
44echo ${DISTRIBUTION}${VERSION}
Note: See TracBrowser for help on using the repository browser.