OSSP CVS Repository

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

Check-in Number: 3606
Date: 2003-Sep-11 19:59:34 (local)
2003-Sep-11 17:59:34 (UTC)
User:rse
Branch:
Comment: improve and bugfix Linux detection
Tickets:
Inspections:
Files:
ossp-pkg/platform/platform.sh      1.6 -> 1.7     16 inserted, 12 deleted

ossp-pkg/platform/platform.sh 1.6 -> 1.7

--- platform.sh  2003/09/09 09:24:32     1.6
+++ platform.sh  2003/09/11 17:59:34     1.7
@@ -357,17 +357,20 @@
         v_kern=`echo "${UNAME_RELEASE}" |\
             sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
         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`
+            sort -n | tail -1 | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') 2>/dev/null`
         ST="GNU/<Linux >${v_libc}/<${v_kern}>"
         if [ -f /etc/lsb-release ]; then
             eval `( . /etc/lsb-release
-              echo "SC=\"LSB${LSB_VERSION}\""
-              echo "SP=\"${DISTRIB_ID} ${DISTRIB_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
+            for tagfile in x `cd /etc && \
+                /bin/ls *[_-]release *[_-]version 2>/dev/null | \
+                sed -e '/redhat-release/d'; echo redhat-release`; do
+                [ ".${tagfile}" = .x ] && continue
+                [ ! -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/^/#/' \
@@ -379,11 +382,12 @@
                     debian   ) n="Debian[ GNU/Linux]" ;;
                     redhat   ) n="RedHat[ Linux]"     ;;
                     suse     ) n="SuSE[ Linux]"       ;;
-                    mandrake ) n="Mandrake[ Linux}"   ;;
+                    mandrake ) n="Mandrake[ Linux]"   ;;
                     gentoo   ) n="Gentoo[ Linux]"     ;;
                     *        ) n="${n}[ GNU/Linux]"   ;;
                 esac
                 SP="$n $v"
+                break
             done
         fi
         [ ".$SP" = . ] && SP="${ST}"
@@ -518,27 +522,27 @@
 #   create output string
 output=`echo ":$opt_F" |\
         sed -e "s/^://" \
-            -e "s;%\[ac\];${AC_V};g" \
+            -e "s;%\\[ac\\];${AC_V};g" \
             -e "s;%{ac};${AC_N};g" \
             -e "s;%ac;${AC_N};g" \
             -e "s;%<ac>;${AC_C};g" \
-            -e "s;%\[ap\];${AP_V};g" \
+            -e "s;%\\[ap\\];${AP_V};g" \
             -e "s;%{ap};${AP_N};g" \
             -e "s;%ap;${AP_N};g" \
             -e "s;%<ap>;${AP_C};g" \
-            -e "s;%\[at\];${AT_V};g" \
+            -e "s;%\\[at\\];${AT_V};g" \
             -e "s;%{at};${AT_N};g" \
             -e "s;%at;${AT_N};g" \
             -e "s;%<at>;${AT_C};g" \
-            -e "s;%\[sc\];${SC_V};g" \
+            -e "s;%\\[sc\\];${SC_V};g" \
             -e "s;%{sc};${SC_N};g" \
             -e "s;%sc;${SC_N};g" \
             -e "s;%<sc>;${SC_C};g" \
-            -e "s;%\[sp\];${SP_V};g" \
+            -e "s;%\\[sp\\];${SP_V};g" \
             -e "s;%{sp};${SP_N};g" \
             -e "s;%sp;${SP_N};g" \
             -e "s;%<sp>;${SP_C};g" \
-            -e "s;%\[st\];${ST_V};g" \
+            -e "s;%\\[st\\];${ST_V};g" \
             -e "s;%{st};${ST_N};g" \
             -e "s;%st;${ST_N};g" \
             -e "s;%<st>;${ST_C};g" \

CVSTrac 2.0.1