Last change
on this file since 660 was
499,
checked in by rybkin, 15 years ago
|
See C.L. 394
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
File size:
1.7 KB
|
Rev | Line | |
---|
[2] | 1 | |
---|
| 2 | # Determine the Linux distribution and version that is being run. |
---|
| 3 | # |
---|
| 4 | |
---|
[465] | 5 | export LC_ALL=C |
---|
[2] | 6 | # Check for GNU/Linux distributions |
---|
| 7 | if [ -f /etc/SuSE-release ]; then |
---|
[432] | 8 | DISTRIBUTION="suse" |
---|
| 9 | VERSION=`sed -n '/VERSION/{s#[^0-9]##gp;q}' /etc/SuSE-release` |
---|
[2] | 10 | elif [ -f /etc/UnitedLinux-release ]; then |
---|
[432] | 11 | DISTRIBUTION="united" |
---|
| 12 | VERSION=`cat /etc/UnitedLinux-release` |
---|
[2] | 13 | elif [ -f /etc/debian_version ]; then |
---|
[432] | 14 | DISTRIBUTION="debian" |
---|
[2] | 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 |
---|
[432] | 22 | elif [ -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 | ;; |
---|
[499] | 34 | Scientific*Linux*CERN*) |
---|
[432] | 35 | DISTRIBUTION=slc |
---|
| 36 | ;; |
---|
[499] | 37 | Scientific*Linux*) |
---|
| 38 | DISTRIBUTION=sl |
---|
| 39 | ;; |
---|
| 40 | Fedora*) |
---|
| 41 | DISTRIBUTION=fedora |
---|
| 42 | ;; |
---|
[432] | 43 | *) |
---|
| 44 | DISTRIBUTION=slc |
---|
| 45 | ;; |
---|
| 46 | esac |
---|
| 47 | VERSION="" |
---|
[499] | 48 | release= |
---|
| 49 | for w in `echo $a`; do |
---|
| 50 | case "$w" in |
---|
| 51 | release) |
---|
| 52 | release=y |
---|
| 53 | ;; |
---|
| 54 | *) |
---|
| 55 | if [ "$release" ]; then |
---|
| 56 | VERSION=$w |
---|
| 57 | release= |
---|
| 58 | fi |
---|
| 59 | ;; |
---|
[432] | 60 | esac |
---|
| 61 | done |
---|
[499] | 62 | # while [ -n "$a" ]; do |
---|
| 63 | # t="${a#?}" # all but first char of $a |
---|
| 64 | # c=${a%"${t}"} # first char of $a |
---|
| 65 | # a="${t}" # remove first char from $a |
---|
| 66 | # case "$c" in |
---|
| 67 | # [0-9]) |
---|
| 68 | # VERSION="${VERSION}${c}" |
---|
| 69 | # ;; |
---|
| 70 | # esac |
---|
| 71 | # done |
---|
[432] | 72 | case "$VERSION" in |
---|
| 73 | 70|71|72) |
---|
| 74 | VERSION=73 |
---|
| 75 | ;; |
---|
| 76 | esac |
---|
[499] | 77 | [ "$VERSION" ] || VERSION='00' |
---|
[432] | 78 | else |
---|
| 79 | DISTRIBUTION="unknown" |
---|
[2] | 80 | VERSION='00' |
---|
[432] | 81 | fi |
---|
[2] | 82 | |
---|
[499] | 83 | echo ${DISTRIBUTION}-${VERSION} |
---|
Note: See
TracBrowser
for help on using the repository browser.