Re: Advice on installing an Agent to the users home directory [SOLVED]
Re: Advice on installing an Agent to the users home directory [SOLVED]
- Subject: Re: Advice on installing an Agent to the users home directory [SOLVED]
- From: Citizen <email@hidden>
- Date: Thu, 27 Aug 2009 16:27:14 +0100
On 26 Aug 2009, at 13:25, Citizen wrote:
My new application includes a User Agent. I want to give the user
the option to install this application in the system domain or the
user domain. My second requirement was that the installer launches
the Agent without a system restart or logout.
I'm using PackageMaker 3 and targeting OS X 10.5 (Leopard) and later.
Spurred on by Iceberg-Dev suggestion I came up with a solution. Using
the same property list as before:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zenopolis.ApplicationAgent</string>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/Name/Desktop/stderror.txt</string>
<key>StandardOutPath</key>
<string>/Users/Name/Desktop/stdout.txt</string>
<key>ProgramArguments</key>
<array>
<string>-ROOTPREFIX-/Applications/ApplicationAgent.app/Contents/
MacOS/ApplicationAgent</string>
</array>
</dict>
</plist>
I now use the following script to change the -ROOTPREFIX- place marker
and launch the Agent:
------
#!/usr/bin/env bash
echo $SCRIPT_NAME: launching TiptoeAgent
if test -e ~/Library/LaunchAgents/com.zenopolis.TiptoeAgent.plist; then
sed -iTemp 's|-ROOTPREFIX-|'$HOME'|' ~/Library/LaunchAgents/
com.zenopolis.TiptoeAgent.plist
rm ~/Library/LaunchAgents/com.zenopolis.TiptoeAgent.plistTemp
chown root:wheel ~/Library/LaunchAgents/com.zenopolis.TiptoeAgent.plist
chmod 644 ~/Library/LaunchAgents/com.zenopolis.TiptoeAgent.plist
launchctl load ~/Library/LaunchAgents/com.zenopolis.TiptoeAgent.plist
elif test -e /Library/LaunchAgents/com.zenopolis.TiptoeAgent.plist; then
sed -iTemp 's|-ROOTPREFIX-||' /Library/LaunchAgents/
com.zenopolis.TiptoeAgent.plist
rm /Library/LaunchAgents/com.zenopolis.TiptoeAgent.plistTemp
launchctl load /Library/LaunchAgents/com.zenopolis.TiptoeAgent.plist
fi
exit 0
------
Thanks,
David Kennedy (http://www.zenopolis.com)
_______________________________________________
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