OSSP CVS Repository

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

Check-in Number: 5948
Date: 2007-Jun-04 09:58:50 (local)
2007-Jun-04 07:58:50 (UTC)
User:rse
Branch:
Comment: Improve Mac OS X detection in "shtool plaform"
Tickets:
Inspections:
Files:
ossp-pkg/shtool/ChangeLog      1.233 -> 1.234     5 inserted, 0 deleted
ossp-pkg/shtool/sh.platform      1.18 -> 1.19     30 inserted, 5 deleted

ossp-pkg/shtool/ChangeLog 1.233 -> 1.234

--- ChangeLog    2007/05/19 19:09:38     1.233
+++ ChangeLog    2007/06/04 07:58:50     1.234
@@ -9,6 +9,11 @@
 
  ChangeLog
 
+ Changes between 2.0.7 and 2.0.8 (19-May-2007 to xx-XXX-2007):
+
+   *) Improved Mac OS X detection in "shtool plaform".
+      [Ralf S. Engelschall]
+
  Changes between 2.0.6 and 2.0.7 (19-Apr-2006 to 19-May-2007):
 
    *) Upgrade build environment to GNU autoconf 2.61


ossp-pkg/shtool/sh.platform 1.18 -> 1.19

--- sh.platform  2007/05/19 19:09:39     1.18
+++ sh.platform  2007/06/04 07:58:50     1.19
@@ -398,6 +398,7 @@
 
     #   IBM AIX
     *:AIX:* )
+        #   determine architecture
         cpu_arch=rs6000
         if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then
             cpu_id=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
@@ -419,6 +420,7 @@
         AT="${cpu_arch}"
         AP="${AT}"
         AC="${AP}"
+        #   determine system
         ST="[IBM ]<AIX >${os_level}"
         SP="${ST}"
         case "${os_level}" in
@@ -427,9 +429,10 @@
         esac
         ;;
 
-    #   Apple MacOS X Darwin
+    #   Apple Mac OS X (Darwin)
     *:Darwin:* )
-        AT=`uname -p`
+        #   determine architecture
+        AT="`uname -p`"
         case "${AT}" in
             powerpc ) AT="PPC" ;;
         esac
@@ -438,9 +441,31 @@
         case "${AC}" in
             i?86 ) AC="iX86" ;;
         esac
-        ST="[Apple ]${UNAME_SYSTEM} ${UNAME_RELEASE}"
-        SP="${ST}"
-        SC="4.4BSD/Mach3"
+        #   determine system
+        eval `echo "${UNAME_RELEASE}" |\
+              sed -e 's/^/#/' \
+                  -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
+                  -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
+                  -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
+                  -e 's/^#.*$/v1="0"/'`
+        ST="[Apple ]${UNAME_SYSTEM} <${v1}>${v2+.$v2}${v3+[.$v3]}"
+        SP="$ST"
+        v="`(sw_vers) 2>/dev/null | grep 'ProductVersion:' | sed -e 's/^ProductVersion: *//'`"
+        if [ ".$v" != . ]; then
+            #   use given Mac OS X product information
+            SP="[Apple ]Mac OS X ${v}"
+        else
+            #   fetch Mac OS X product information manually
+            for name in System Server; do
+                if [ -f /System/Library/CoreServices/${name}Version.plist ]; then
+                    v=`(defaults read "/System/Library/CoreServices/${name}Version" "ProductVersion") 2>/dev/null`
+                    if [ ".$v" != . ]; then
+                        SP="[Apple ]Mac OS X ${v}"
+                    fi
+                fi
+            done
+        fi
+        SC="4.4BSD/Mach3.0"
         ;;
 
     #   TODO ...ADD YOUR NEW PLATFORM CHECK HERE... TODO

CVSTrac 2.0.1