Re: Option to execute a command?
Re: Option to execute a command?
- Subject: Re: Option to execute a command?
- From: Per Olofsson <email@hidden>
- Date: Wed, 30 Mar 2011 07:14:55 +0000
- 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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden