Re: Launch agent runs as root immediately after install
Re: Launch agent runs as root immediately after install
- Subject: Re: Launch agent runs as root immediately after install
- From: Nick Peelman <email@hidden>
- Date: Fri, 19 Mar 2010 15:30:29 -0400
Reboots and Logouts are terrible, and for what? To save the packager
5 minutes of logic? A reboot costs me 15 minutes, minimum. More
depending on what i'm doing. That cost varies user to user, but its
still a pain in the ass for anybody involved and reminds me too much
of Windows.
Macs can load (almost) everything (including kernel extensions)
dynamically, and it says a lot about an application that can pop
through its installer and be ready to go without a reboot; more
concisely, it presents a MUCH better user experience. When VMWare got
this right with Fusion 3 it made a big impact on my perception of
things, and I was jaded by VMWare long ago.
Xo has the right idea here; if you are concerned about the potential
for multiple users, you handle those cases (via InstallationCheck) by
only allowing the install to happen when one user is logged in. For a
/Library/LaunchAgents this is the way it SHOULD be anyway, because you
don't want to go unloading daemons or agents that may otherwise be in
use, nor should you be running updates/installs and loading things for
sessions that aren't yours (from the user's perspective, even if
they're an admin).
if (`who | grep console | wc | awk '{ print $1 }'` > 1)
exit 112;
Unless they change how they display the console sessions in the who
command, or take away grep, wc, or awk, that's pretty bulletproof
across versions, and if the install is being run by root remotely via
SSH or via ARD it should fall through that without issue.
launchctl logic hasn't changed *that* much between 10.5 and 10.6, for
the most part load and unload work the same, the biggest change being
how the -w flag is handled, and you shouldn't be using the -w flag
anyway when loading/unloading.
And i just want to point out that your method for starting up the
process in userspace is absolutely overkill. All you need is:
`su $USER -c 'launchctl unload /Library/LaunchAgents/com.company.binary.plist'`
The bsexec is waaay nerdier, if that's what your going for, but
variations of the above work for me (and many others), with lots of
success.
-nick
--
Nick Peelman
email@hidden
On Fri, Mar 19, 2010 at 2:50 PM, Greg Neagle
<email@hidden> wrote:
>
> On Mar 19, 2010, at 11:39 AM, Greg Neagle wrote:
>
>> Any other complicated launchctl hackery will work differently in 10.5 and
>> 10.6, and may brake
>
> s/brake/break/
> _______________________________________________
> 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
>
_______________________________________________
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