From 9cf94dce64debdb658b9591d92493e2b74ef5872 Mon Sep 17 00:00:00 2001 From: Ian Silvester Date: Fri, 16 Mar 2012 01:23:03 +0000 Subject: [PATCH] Version references now automatically populated during package build workflow --- OS X Package Builder HOWTO.txt | 9 +++------ Packagemaker Instructions.txt | 2 +- constructPkgContent.sh | 7 +++++++ .../Applications/Privoxy/uninstall.command | 9 +++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/OS X Package Builder HOWTO.txt b/OS X Package Builder HOWTO.txt index a6284d9..676058f 100644 --- a/OS X Package Builder HOWTO.txt +++ b/OS X Package Builder HOWTO.txt @@ -5,7 +5,7 @@ This document will guide you through the complete process necessary to create a ASSUMPTIONS -1. That the read-only Privoxy CVS project has been downloaded from Sourceforge, pinned at whichever release you intend to build. +1. That the Privoxy CVS project has been exported from Sourceforge to a folder named 'dist', pinned at whichever release you intend to build (as per the instructions in the developer manual). 2. That you have Xcode installed, including the SDKs for each OS X version you intend your package(s) to support. 3. That your build machine runs Snow Leopard (OS X 10.6). It will likely work equally well on Leopard or Lion (or later), but PackageMaker is substantially different in Tiger and earlier versions of OS X (even the project file format is different). 4. All references to files and folders in this document should be assumed to be within the OSXBuildSystem folder unless stated otherwise. @@ -35,10 +35,7 @@ which will build a Universal binary containing targets for PPC, i386 and x86_64 Use constructPkgContent.sh to build the hierarchy of folders and files necessary for building the package. This will construct a new folder named 'pkg content' and copy in the binary, documentation and supporting files. -Once this is done, the following files will need to be edited: - -pkg content/Applications/Privoxy/uninstall.command -- the two lines that delete the package installation receipt need correcting for the Privoxy version being built +Once this is done, the following file will need to be edited: pkg resources/interface texts/ReadMe.txt - this can be distilled from the README for the latest Privoxy project release @@ -46,7 +43,7 @@ pkg resources/interface texts/ReadMe.txt 3. Build the package -Open OSX 10.5+.pmdoc in PackageMaker (OSX 10.4.pmdoc is supplied for Tiger since a different package format is required there). See the separate document "Packagemaker Instructions.txt" if you wish to create a package from scratch; otherwsie only the following list of entries will need to be changed to match the Privoxy version you're working with: +Open OSX 10.5+.pmdoc in PackageMaker (OSX 10.4.pmdoc is supplied for Tiger since a different package format is required there). See the separate document "Packagemaker Instructions.txt" if you wish to create a package from scratch; otherwise only the following list of entries will need to be changed to match the Privoxy version you're working with (see Packagemaker Instructions.txt for more details about restrictions on the values you can set): Distribution left-menu item>Configuration>Title pkg content left-menu item>pkg content>Configuration>Package Identifier diff --git a/Packagemaker Instructions.txt b/Packagemaker Instructions.txt index eb1fcf3..3999b4f 100644 --- a/Packagemaker Instructions.txt +++ b/Packagemaker Instructions.txt @@ -49,7 +49,7 @@ Package: pkg content Configuration Destination is / No custom location -The Package Identifier should be in the form: 'org.ijbswa.privoxy3019.pkg'. This value also needs to be plugged into the uninstall.command script since I have not yet worked out how to do that programmatically from one of the pre/postinstall scripts. +The Package Identifier _MUST_ be in the form: 'org.ijbswa.privoxyX.Y.ZZ.pkg' where X.Y.ZZ is the release version (e.g. 3.0.19). This is important since the uninstall.command script is populated with this name by a separate process. Package Version is irrelevant. Restart Action: None Require admin authentication should be ticked. diff --git a/constructPkgContent.sh b/constructPkgContent.sh index 54177b6..295c15a 100755 --- a/constructPkgContent.sh +++ b/constructPkgContent.sh @@ -42,6 +42,13 @@ echo "Copy the package skeleton (the unchanging content) to a new folder named ' echo "" cp -vR pkg\ content\ skeleton pkg\ content +# Replace the version number placeholders in the uninstallation script +echo "" +echo "Replace the version number placeholders in the uninstallation script" +echo "" +VERSION=`perl findversion.pl ../current/ChangeLog` +sed "s/PRIVOXY_VERSION/${VERSION}/g" pkg\ content\ skeleton/Applications/Privoxy/uninstall.command > pkg\ content/Applications/Privoxy/uninstall.command + # Copy the compiled privoxy binary from the 'current' project echo "" echo "" diff --git a/pkg content skeleton/Applications/Privoxy/uninstall.command b/pkg content skeleton/Applications/Privoxy/uninstall.command index 567f0a3..6c308a8 100755 --- a/pkg content skeleton/Applications/Privoxy/uninstall.command +++ b/pkg content skeleton/Applications/Privoxy/uninstall.command @@ -69,14 +69,11 @@ if [ "$UID" -eq "$root_UID" ]; then # Delete all items referenced by the installation package echo 'Delete package installation receipt (ignore errors relating to other bundle identifiers).' - # TODO overwrite PKGNAME during postinstall execution with the name of the package being installed. - # In the meantime, the package name must be manually entered for each release. - #pkgutil --forget PKGNAME - # if OS X 10.5 or newer then use the new pkgutil command else simply delete the receipt file + # On OS X 10.5 or newer we can use the new pkgutil command else simply delete the receipt file if [ -x /usr/sbin/pkgutil ]; then - pkgutil --forget org.ijbswa.privoxy3019.pkg + pkgutil --forget org.ijbswa.privoxyPRIVOXY_VERSION.pkg else - rm -rf /Library/Receipts/Privoxy\ 3.0.19\ OS\ X\ 10.4.pkg + rm -rf /Library/Receipts/Privoxy\ PRIVOXY_VERSION\ OS\ X\ 10.4.pkg fi # Check the Trash, just in case the user manually removed the only obvious item from /Applications -- 2.39.2