Re: Option to execute a command?
Re: Option to execute a command?
- Subject: Re: Option to execute a command?
- From: Greg Neagle <email@hidden>
- Date: Wed, 30 Mar 2011 11:36:34 -0700
Let us assume you are working from Per Olofsson's example.
> 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
This unloads the launchd job defined in /Library/LaunchDaemons/edu.caltech.autonomy.foo.plist only if it already exists. This is useful for reinstalls and installs of new versions of your software. The file does not need to exist.
>
> postinstall:
>
>> #!/bin/bash
>>
>> launchctl load -w /Library/LaunchDaemons/edu.caltech.autonomy.foo.plist
>>
Since this is a postinstall script, the payload has been installed, which presumably includes your launchd plist.
This script simply tells launchd to load the plist.
So I don't see why you need the plist file anywhere other than your package payload.
-Greg
On Mar 30, 2011, at 11:27 AM, Nathan Sims wrote:
> On Mar 30, 2011, at 10:45 AM, Greg Neagle wrote:
>
>> On Mar 30, 2011, at 10:37 AM, Nathan Sims wrote:
>>
>>> How can I have PackageMaker place the $LAUNCHD plist into the LaunchAgents folder so that launchctl can run it?
>>>
>> By making it part of your package payload, just like any other file you'd like installed.
>
> But doesn't the preinstall script get run before any files get moved?
>
_______________________________________________
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