Re: Advice on installing an Agent to the users home directory [SOLVED]
site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com On 26 Aug 2009, at 13:25, Citizen wrote: ------ #!/usr/bin/env bash echo $SCRIPT_NAME: launching TiptoeAgent 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 (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... 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: 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 This email sent to site_archiver@lists.apple.com
participants (1)
-
Citizen