Re: Launch agent runs as root immediately after install
site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.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... This email sent to site_archiver@lists.apple.com
Hi,
Launch the agent in all logged in user context. for userName in `/usr/bin/users`
do
su -l $userName -c "launchctl load -S Aqua
/Library/LaunchAgents/com.yourcmpny.plist"
done But there are some disadvantages when you have to support multiple
logged in Users at the time of Install which I have discussed in the
below link which you might want to take a look at.
http://old.nabble.com/launch_msg%28%29:-Socket-is-not-connected-
td23923855.html
regards,
~Arjun
If this works for you I will be a little surprised. It did not work for me on SnowLeopard. When starting the agent for a user other than the one who is doing the installation, launchctl throws an error at me. However, when using the GUI installer, the environment variable $USER is set to the user who invoked the installer. If you have to use sudo to install from the command line, then maybe you can check for COMMAND_LINE_INSTALL=1 and not start the agent because your $USER will be set to root. The InstallationCheck script will get the SUDO_USER but the postinstall and preinstall won't get the SUDO_USER.
participants (1)
-
Xochitl Lunde