[launchd-dev] Install and load a launch daemon without a reboot

Jeremy Reichman jaharmi at jaharmi.com
Thu Jan 27 12:47:33 PST 2011


On 1/26/2011 4:39 AM, "Quinn "The Eskimo!"" <eskimo1 at apple.com> wrote:


>>If so, then you need to require root/admin authentication in the
>>installation package (to be able to install stuff in
>>/Library/LaunchDaemons/.
>
>One thing to be careful of is the distinction between EUID and RUID.
>IIRC the Installer, when yo escalated privileges, only sets the EUID,
>leaving the RUID set to that of the user who ran the Installer.  This
>causes problem for launchctl, because launchctl uses the RUID to decide
>which launchd to talk to.  You can use the chroot trick from my previous
>post to set both the EUID and RUID to 0.

I was actually going to script this in Python but used the shell script
snippet as a quick-and-dirty example. My Python if statement looks like
this at the moment:

import posix
if posix.getuid() and posix.geteuid() == 0:
     # launchctl here

Quinn, did you mean the chroot idea in the "bootstrap" thread? If so, I'll
either need a little more time to digest it, or just request a reboot with
the installer. It sounds as if running the above Python in the context of
an Installer postflight script would result in a no-op because of the RUID.

Thanks!

-- 
Jeremy




More information about the launchd-dev mailing list