Changeset 432 for CMT/HEAD


Ignore:
Timestamp:
Jan 14, 2008, 6:18:51 PM (16 years ago)
Author:
rybkin
Message:

See C.L. 338

Location:
CMT/HEAD
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r431 r432  
     12008-01-14    <rybkin@lal.in2p3.fr> 338
     2
     3        * mgr/cmt_dcc_version.sh: Optimise by reducing the number of processes
     4        making use of sed
     5        * mgr/cmt_gcc_version.sh: idem
     6        * mgr/cmt_filter_version.sh: idem
     7        * mgr/cmt_filter3_version.sh: idem
     8        * mgr/cmt_linux_version.sh: Optimise by reducing the number of processes
     9        making use of sed and the POSIX shell features (patch from KELEMEN Peter)
     10       
    1112008-01-14    <rybkin@lal.in2p3.fr> 337
    212
  • CMT/HEAD/mgr/cmt_dcc_version.sh

    r28 r432  
    11
    22cc -v 2>&1 |\
    3  grep version |\
    4  cut -d ' ' -f3 |\
    5  sed -e 's#^[0-9]#gcc-&#'
    6 
    7 
     3 sed -n '/version/s#^[^ ]* [^ ]* \([0-9][^ ]*\) *.*#gcc-\1#p'
  • CMT/HEAD/mgr/cmt_filter3_version.sh

    r27 r432  
    1010#
    1111#   Output format
    12 #    <some letters><field1><field2>
     12#    <some letters><field1><field2><field3>
    1313#
    1414#   o only the first two numeric fields are kept
     
    1717#--------------------------------------------------
    1818
    19 read value
    20 
    21 c=`echo $value | sed -e 's#[-.0-9]##g'`
    22 v=`echo $value | \
    23    sed -e 's#[^-.0-9]##g' -e 's#^[^0-9]##' -e 's#[-]#.#g' | \
    24    cut -d '.' -f1-3 | \
    25    sed -e 's#[-.]##g'`
    26 
    27 echo ${c}${v}
    28 
     19exec sed -n '
     20h
     21s#[-.0-9]##g
     22x
     23s#[^-.0-9]##g
     24s#^[^0-9]##
     25y#-.#  #
     26s#^\([0-9]*\) *\([0-9]*\) *\([0-9]*\) *.*#\1\2\3#
     27G
     28s#\(.*\)\n\(.*\)#\2\1#p
     29'
  • CMT/HEAD/mgr/cmt_filter_version.sh

    r27 r432  
    1717#--------------------------------------------------
    1818
    19 read value
    20 
    21 c=`echo $value | sed -e 's#[-.0-9]##g'`
    22 v=`echo $value | \
    23    sed -e 's#[^-.0-9]##g' -e 's#^[^0-9]##' -e 's#[-]#.#g' | \
    24    cut -d '.' -f1,2 | \
    25    sed -e 's#[-.]##g'`
    26 
    27 echo ${c}${v}
    28 
     19exec sed -n '
     20h
     21s#[-.0-9]##g
     22x
     23s#[^-.0-9]##g
     24s#^[^0-9]##
     25y#-.#  #
     26s#^\([0-9]*\) *\([0-9]*\) *.*#\1\2#
     27G
     28s#\(.*\)\n\(.*\)#\2\1#p
     29'
  • CMT/HEAD/mgr/cmt_gcc_version.sh

    r27 r432  
    11
    22gcc -v 2>&1 |\
    3  grep version |\
    4  cut -d ' ' -f3 |\
    5  sed -e 's#^[0-9]#gcc-&#'
    6 
     3 sed -n '/version/s#^[^ ]* [^ ]* \([0-9][^ ]*\) *.*#gcc-\1#p'
  • CMT/HEAD/mgr/cmt_linux_version.sh

    r27 r432  
    55# Check for GNU/Linux distributions
    66if [ -f /etc/SuSE-release ]; then
    7   DISTRIBUTION="suse"
     7    DISTRIBUTION="suse"
     8    VERSION=`sed  -n '/VERSION/{s#[^0-9]##gp;q}' /etc/SuSE-release`
    89elif [ -f /etc/UnitedLinux-release ]; then
    9   DISTRIBUTION="united"
     10    DISTRIBUTION="united"
     11    VERSION=`cat /etc/UnitedLinux-release`
    1012elif [ -f /etc/debian_version ]; then
    11   DISTRIBUTION="debian"
    12 elif [ -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
    30 else
    31   DISTRIBUTION="unknown"
    32 fi
    33 
    34 ###    VERSION=`rpm -q redhat-release | sed -e 's#redhat[-]release[-]##'`
    35 
    36 case ${DISTRIBUTION} in
    37 rh|cel|rhel|slc)
    38     VERSION=`cat /etc/redhat-release | sed -e 's#[^0-9]##g' -e 's#7[0-2]#73#'`
    39     ;;
    40 debian)
     13    DISTRIBUTION="debian"
    4114    VERSION=`cat /etc/debian_version`
    4215    if [ ${VERSION} = "testing/unstable" ]; then
     
    4619        VERSION=""
    4720    fi
    48     ;;
    49 suse)
    50     VERSION=`cat /etc/SuSE-release | grep 'VERSION' | sed  -e 's#[^0-9]##g'`
    51     ;;
    52 united)
    53     VERSION=`cat /etc/UnitedLinux-release`
    54     ;;
    55 *)
     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"
    5659    VERSION='00'
    57     ;;
    58 esac;
     60fi
    5961
    6062echo ${DISTRIBUTION}${VERSION}
Note: See TracChangeset for help on using the changeset viewer.