Check-in Number:
|
5949 | |
Date: |
2007-Jun-04 17:14:08 (local)
2007-Jun-04 15:14:08 (UTC) |
User: | rse |
Branch: | |
Comment: |
improve Mac OS X detection again |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/shtool/sh.platform 1.19 -> 1.20
--- sh.platform 2007/06/04 07:58:50 1.19
+++ sh.platform 2007/06/04 15:14:08 1.20
@@ -442,29 +442,34 @@
i?86 ) AC="iX86" ;;
esac
# determine system
+ unset v1; unset v2; unset v3
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]}"
+ 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
+ v="`(sw_vers) 2>/dev/null | grep 'ProductVersion:' | sed -e 's/^ProductVersion:[^0-9]*\([0-9][0-9.]*\).*$/\1/'`"
+ if [ ".$v" = . ]; then
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
+ [ ".$v" != . ] && break
fi
done
fi
+ if [ ".$v" != . ]; then
+ unset v1; unset v2; unset v3
+ eval `echo "${v}" |\
+ 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"/'`
+ SP="[Apple ]<Mac OS X ${v1}>${v2+.$v2}${v3+[.$v3]}"
+ fi
SC="4.4BSD/Mach3.0"
;;
|
|