OSSP CVS Repository

ossp - Check-in [3568]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3568
Date: 2003-Sep-08 21:13:00 (local)
2003-Sep-08 19:13:00 (UTC)
User:rse
Branch:
Comment: better LSB support for Linux boxes (especially important for SuSE)
Tickets:
Inspections:
Files:
ossp-pkg/platform/platform.sh      1.3 -> 1.4     28 inserted, 20 deleted

ossp-pkg/platform/platform.sh 1.3 -> 1.4

--- platform.sh  2003/09/08 19:03:03     1.3
+++ platform.sh  2003/09/08 19:13:00     1.4
@@ -359,27 +359,35 @@
         v_libc=`(strings /lib/libc.so.* | grep '^GLIBC_' | sed -e 's/^GLIBC_//' |\
             sort -n | tail -1 | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') 2>&1`
         ST="GNU/Linux ${v_libc}/${v_kern}"
-        for tagfile in dummy `cd /etc && echo *[_-]release *[_-]version 2>/dev/null`; do
-            test ! -f /etc/${tagfile} && continue
-            n=`echo ${tagfile} | sed -e 's/[_-]release$//' -e 's/[_-]version$//'`
-            v=`cat /etc/${tagfile} | grep '[0-9]' | head -1 |\
-               sed -e 's/^/#/' \
-                   -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
-                   -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
-                   -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
-                   -e 's/^#.*$//'`
-            case "`util_lower ${n}`" in
-                debian   ) n="Debian[ GNU/Linux]" ;;
-                redhat   ) n="RedHat[ Linux}"     ;;
-                suse     ) n="SuSE[ Linux]"       ;;
-                mandrake ) n="Mandrake[ Linux}"   ;;
-                gentoo   ) n="Gentoo[ Linux]"     ;;
-                *        ) n="${n}[ GNU/Linux]"   ;;
-            esac
-            SP="$n $v"
-        done
+        if [ -f /etc/lsb-release ]; then
+            eval `( . /etc/lsb-release
+              echo "SC=\"LSB${LSB_VERSION}\""
+              echo "SP=\"${DISTRIB_ID} ${DISTRIB_RELEASE}\""
+            ) 2>/dev/null`
+        fi
+        if [ ".$SP" = . ]; then
+            for tagfile in dummy `cd /etc && echo *[_-]release *[_-]version 2>/dev/null`; do
+                test ! -f /etc/${tagfile} && continue
+                n=`echo ${tagfile} | sed -e 's/[_-]release$//' -e 's/[_-]version$//'`
+                v=`cat /etc/${tagfile} | grep '[0-9]' | head -1 |\
+                   sed -e 's/^/#/' \
+                       -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
+                       -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
+                       -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
+                       -e 's/^#.*$//'`
+                case "`util_lower ${n}`" in
+                    debian   ) n="Debian[ GNU/Linux]" ;;
+                    redhat   ) n="RedHat[ Linux]"     ;;
+                    suse     ) n="SuSE[ Linux]"       ;;
+                    mandrake ) n="Mandrake[ Linux}"   ;;
+                    gentoo   ) n="Gentoo[ Linux]"     ;;
+                    *        ) n="${n}[ GNU/Linux]"   ;;
+                esac
+                SP="$n $v"
+            done
+        fi
         [ ".$SP" = . ] && SP="${ST}"
-        SC="LSB"
+        [ ".$SC" = . ] && SC="LSB"
         ;;
 
     #   Sun Solaris

CVSTrac 2.0.1