site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com Thread-index: AQHL7kJU1BT4POw5L0OnxLhGDUmecpRFVkuA Thread-topic: Option to execute a command? 29 mar 2011 kl. 20:51 skrev Nathan Sims:
I'm just starting out with PackageMaker 3.0 (OSX 10.6.7), and by using the (outdated) Apple documentation I have been able to build a package, but I need to run a command before and after the installation to tell launchctl to first unload any existing version of the app, then afterwards to load the newly installed version.
In the Actions tab for the distribution, I see "Preinstall Actions" and "Postinstall Actions", but I don't see the option to execute a command anywhere. How does one do this?
What you want is preinstall and postinstall scripts. Quick walkthrough:
Start by creating a folder named Scripts, and inside create two bash scripts:
preinstall:
#!/bin/bash
LAUNCHD=/Library/LaunchDaemons/edu.caltech.autonomy.foo.plist if [ -e "$LAUNCHD" ]; then launchctl unload -w "$LAUNCHD" fi
postinstall:
#!/bin/bash
launchctl load -w /Library/LaunchDaemons/edu.caltech.autonomy.foo.plist
Then chmod +x preinstall postinstall.
Now in your packagemaker project, expand the component choice that you wish to add scripts for under Contents (NB: not the Distribution), and select the sub-package. Switch to the Scripts tab, and select the folder you created as the Scripts directory (leave Preinstall and Postinstall blank). Save and build.
-- Per Olofsson System Administrator, ITS, University of Gothenburg _______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com