Re: How can I "un-sudo" in postflight?
Re: How can I "un-sudo" in postflight?
- Subject: Re: How can I "un-sudo" in postflight?
- From: Conor Schutzman <email@hidden>
- Date: Mon, 02 Dec 2013 12:21:58 -0800
ConsoleUser=$(stat -f %Su "/dev/consoleā)
sudo -u $ConsoleUser foo
Might be worth putting an if-then to check that $ConsoleUser is not root (such as it is when at the login window).
On Dec 2, 2013, at 11:40 AM, Mitchell J Laurren-Ring <email@hidden> wrote:
> I've recently added a launchd plist to my installer and need to load it during postflight (which is running as root). For it to work correctly (as a launch agent), I need to execute launchctl as the current user, not root. I tried using "sudo -u $SUDO_USER" but apparently this ENV variable is set to "launchctl" at postflight time.
>
> How do execute something from postflight as "not root", preferably the installing user?
>
>
> /Mick
> _______________________________________________
> 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