"Fossies" - the Fresh Open Source Software Archive

Member "fou4s-0.16.0/SuSE-release" (17 Oct 2009, 3957 Bytes) of package /linux/privat/old/fou4s-0.16.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 # This is part of fou4s
    3 # Copyright (C) 2002-2005 Markus Gaugusch <fou4s@gaugusch.at>
    4 #
    5 # SVN info:
    6 # $Author: markus $
    7 # $Date: 2009-10-17 22:12:44 +0200 (Sat, 17 Oct 2009) $
    8 # $Rev: 210 $
    9 
   10 ################################ getSuSEVersion
   11 # get version of the running suse product. Used to get the right
   12 # patches from ftp server.
   13 # Modifies: SUSEVERSION, ARCH, SUSEPRODUCT
   14 
   15 # try the following files (in this order)
   16 RELEASE_FILES="/etc/SuSE-release /etc/SLOX-release /etc/UnitedLinux-release"
   17 
   18 function getSuSEVersion()
   19 {
   20     local updateinf=/var/lib/YaST/update.inf suserelease=''
   21     for rel_file in $RELEASE_FILES
   22     do
   23         if [ -r "$rel_file" ]; then 
   24             suserelease="$rel_file" 
   25             break
   26         fi
   27     done
   28     if [ -z "$suserelease" ]; then
   29         echo "$0: a release file not found. Tried $RELEASE_FILES. Aborting." >&2
   30         exit 1
   31     fi
   32 
   33     SUSEVERSION=`grep ^VERSION $suserelease`
   34     SUSEVERSION=${SUSEVERSION##VERSION = }
   35     SUSEVERSION=${SUSEVERSION%%-SERVER} # for SLE/Email Server II
   36     ARCH=`head -1 $suserelease | tr 'A-Z' 'a-z'`
   37     # hack for SLES8 (has no update.inf)
   38     [[ $ARCH == suse\ sles-8* ]] && SUSEVERSION=8 && SUSEPRODUCT=SuSE-SLES && NODOTSUSEVERSION=81
   39     # hack for SLOX4 (has no update.inf)
   40     [[ $ARCH == suse\ linux\ openexchange\ server\ 4* ]] && SUSEVERSION=4 && SUSEPRODUCT=Openexchange-Server && NODOTSUSEVERSION=81 && ARCH=i386
   41     # hack for SLES9
   42     [[ $ARCH == suse\ linux\ enterprise\ server\ 9* ]] && SUSEVERSION=9 && SUSEPRODUCT=SUSE-CORE && NODOTSUSEVERSION=90
   43     [[ $ARCH == suse\ linux\ standard\ server\ 8.0* ]] && SUSEVERSION=8 && SUSEPRODUCT=SuSE-Linux-Standard-Server && NODOTSUSEVERSION=90
   44     # hack for SLES10
   45     [[ $ARCH == suse\ linux\ enterprise\ server\ 10* ]] && SUSEVERSION=10 && SUSEPRODUCT=SLES && NODOTSUSEVERSION=101
   46     ARCH=${ARCH##*\(}
   47     ARCH=${ARCH%%\)*}
   48     # translate "architecture name" to download directory:
   49     case "$ARCH" in
   50         alpha) ARCH=axp;;     # SuSE-release contains "Alpha" and ftp dir is named "axp"
   51         amd64) ARCH=x86_64;; # SuSE-release contains "AMD64" and ftp dir is named "x86_64"
   52         x86-64) ARCH=x86_64;; # SuSE-release contains "x86_64" and ftp dir is named "x86_64"
   53         s/390) ARCH=s390;;    # Apparently a directory can't be called "s/390"...
   54     esac
   55     if [ "$NODOTSUSEVERSION" = foo ] ; then
   56         NODOTSUSEVERSION=${SUSEVERSION//./} #version without dots for comparing
   57     fi
   58     if [[ $ARCH == i586 ]] && [ $NODOTSUSEVERSION -ge 82 ] ; then
   59         ARCH=i386 #hack - SuSE-release contains i586 on 8.2 and dirname is "i386"
   60     fi
   61 
   62     [[ $NODOTSUSEVERSION -ge 90 ]] && rpmbuild=rpmbuild || rpmbuild=rpm
   63     VALIDARCHS=`eval $rpmbuild --showrc | grep "^compatible archs" | cut -d: -f2`
   64 
   65     if [ -f $updateinf ] ; then
   66         SUSEPRODUCT="`grep ^Product_Name: $updateinf | head -1`"
   67         SUSEPRODUCT=${SUSEPRODUCT##Product_Name: }
   68         SUSEPRODUCT=${SUSEPRODUCT// /}
   69         if [ "${SUSEPRODUCT:=SuSE-Linux}" = SuSE-Linux ] ; then
   70             SUSEPRODUCT= # empty suseproduct for non-business products
   71             return
   72         else
   73             SUSEVERSION="`grep ^Product_Version: $updateinf`"
   74             SUSEVERSION=${SUSEVERSION##Product_Version: }
   75             SUSEPRODUCT=${SUSEPRODUCT// /-}
   76         fi
   77         if [ -z "$SUSEPRODUCT" ] ; then # still not found - guessing time
   78             SUSEPRODUCT=`head -1 $suserelease`
   79             if [[ $SUSEPRODUCT != SuSE\ Linux* ]] ; then
   80                 SUSEVERSION=${SUSEPRODUCT##*-}
   81                 SUSEVERSION=${SUSEVERSION%% *}
   82                 SUSEPRODUCT=${SUSEPRODUCT//-*/}
   83                 SUSEPRODUCT=${SUSEPRODUCT// /-}
   84             else
   85                 SUSEPRODUCT= # it is probably no business product
   86             fi
   87         fi
   88     fi
   89 } # getSuSEVersion
   90 
   91 ######## main
   92 NODOTSUSEVERSION=foo
   93 getSuSEVersion
   94 test $NODOTSUSEVERSION == foo && \
   95     NODOTSUSEVERSION=${SUSEVERSION//./} # SuSE version without dots for comparing
   96 if [ "$1" = v1.1 ] ; then
   97     echo "SuSE-Release-v1.1: $SUSEVERSION $NODOTSUSEVERSION $ARCH \"$SUSEPRODUCT\" `uname -r` `uname -m`"
   98 elif [ "$1" = v1.2 ] ; then
   99     echo "SuSE-Release-v1.2: $SUSEVERSION $NODOTSUSEVERSION $ARCH \"$SUSEPRODUCT\" `uname -r` `uname -m` ${VALIDARCHS// /+}"
  100 else
  101     echo "SuSE-Release: $SUSEVERSION $NODOTSUSEVERSION $ARCH $SUSEPRODUCT"
  102 fi