From 06dd16f7611ff0863a15dd93af1715d8c8d91c74 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Mon, 26 Mar 2012 20:33:26 -0400 Subject: [PATCH] macos: find packagemaker instead of assuming path in xcode 4.3, packagemaker is unbundled. make no assumptions about where it can be found; instead, let spotlight tell us Reviewed-on: http://gerrit.openafs.org/6966 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit fba35ba4e1d933126c788824f464a78ca1c93bf8) Change-Id: I5d4083fa743ef181d680ffc2934a56d8429a75dc Reviewed-on: http://gerrit.openafs.org/6968 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/packaging/MacOS/buildpkg.sh.in | 53 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/src/packaging/MacOS/buildpkg.sh.in b/src/packaging/MacOS/buildpkg.sh.in index 59bdfb135..5d3247819 100644 --- a/src/packaging/MacOS/buildpkg.sh.in +++ b/src/packaging/MacOS/buildpkg.sh.in @@ -45,28 +45,33 @@ PKGROOT=$CURDIR/pkgroot PKGRES=$CURDIR/pkgres DPKGROOT=$CURDIR/dpkgroot DPKGRES=$CURDIR/dpkgres -if [ $majorvers -ge 7 ]; then - SEP=: - package=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker - if [ ! -x $package ]; then - echo "PackageMaker does not exist. Please run this script on a MacOS X system" - echo "with the DeveloperTools package installed" - exit 1 - fi +PACKAGEMAKER="" +if [ -e "/Developer/usr/bin/packagemaker" ]; then + PACKAGEMAKER="/Developer/usr/bin/packagemaker" else - SEP=. - package=/usr/bin/package - if [ ! -f $package ]; then - echo "$package does not exist. Please run this script on a MacOS X system" - echo "with the BSD subsystem installed" - exit 1 + PACKAGEMAKERS=$(mdfind "(kMDItemCFBundleIdentifier == 'com.apple.PackageMaker')") + if [ -z "$PACKAGEMAKERS" ]; then + echo "packagemaker not found" + exit 1 fi - if grep -q 'set resDir = ""' $package ; then - echo $package is buggy. - echo remove the line \''set resDir = ""'\' from $package and try again - exit 1 + # if there's a space, trying a for blows up + if [ -e "$PACKAGEMAKERS/Contents/MacOS/PackageMaker" ]; then + PACKAGEMAKER="$PACKAGEMAKERS/Contents/MacOS/PackageMaker" + else + for TRYAPP in $PACKAGEMAKERS + do + echo "$TRYAPP/Contents/MacOS/PackageMaker" + if [ -e "$TRYAPP/Contents/MacOS/PackageMaker" ]; then + PACKAGEMAKER="$TRYAPP/Contents/MacOS/PackageMaker" + break + fi + done fi fi +if [ -z "$PACKAGEMAKER" ]; then + echo "packagemaker not found" + exit 1 +fi if [ $firstpass = yes ]; then if [ -x /usr/bin/curl ]; then @@ -223,9 +228,9 @@ if [ $secondpass = yes ]; then cp background.jpg $DPKGRES/background.jpg chown -R root${SEP}wheel $DPKGRES rm -rf $CURDIR/OpenAFS-debug-extension.pkg - echo $package -build -p $CURDIR/OpenAFS-debug-extension.pkg -f $DPKGROOT -r $DPKGRES \ + echo $PACKAGEMAKER -build -p $CURDIR/OpenAFS-debug-extension.pkg -f $DPKGROOT -r $DPKGRES \ -i OpenAFS-debug.Info.plist -d OpenAFS-debug.Description.plist - $package -build -p $CURDIR/OpenAFS-debug-extension.pkg -f $DPKGROOT -r $DPKGRES \ + $PACKAGEMAKER -build -p $CURDIR/OpenAFS-debug-extension.pkg -f $DPKGROOT -r $DPKGRES \ -i OpenAFS-debug.Info.plist -d OpenAFS-debug.Description.plist fi @@ -255,13 +260,13 @@ if [ $secondpass = yes ]; then chown -R root${SEP}wheel $PKGRES rm -rf $CURDIR/OpenAFS.pkg if [ $majorvers -ge 7 ]; then - echo $package -build -p $CURDIR/OpenAFS.pkg -f $PKGROOT -r $PKGRES \ + echo $PACKAGEMAKER -build -p $CURDIR/OpenAFS.pkg -f $PKGROOT -r $PKGRES \ -i OpenAFS.Info.plist -d OpenAFS.Description.plist - $package -build -p $CURDIR/OpenAFS.pkg -f $PKGROOT -r $PKGRES \ + $PACKAGEMAKER -build -p $CURDIR/OpenAFS.pkg -f $PKGROOT -r $PKGRES \ -i OpenAFS.Info.plist -d OpenAFS.Description.plist else - echo $package $PKGROOT $RESSRC/OpenAFS.info -r $PKGRES - (cd $CURDIR && $package $PKGROOT $RESSRC/OpenAFS.info -r $PKGRES) + echo $PACKAGEMAKER $PKGROOT $RESSRC/OpenAFS.info -r $PKGRES + (cd $CURDIR && $PACKAGEMAKER $PKGROOT $RESSRC/OpenAFS.info -r $PKGRES) #old versions of package didn't handle this properly if [ ! -r $CURDIR/OpenAFS.pkg/Contents ]; then mkdir -p $CURDIR/OpenAFS.pkg/Contents/Resources -- 2.39.5