Re: postflight script on Leopard
Re: postflight script on Leopard
- Subject: Re: postflight script on Leopard
- From: James Kelly <email@hidden>
- Date: Mon, 04 Feb 2008 10:17:44 -0500
- Thread-topic: postflight script on Leopard
On 2/4/08 4:52 AM, "Robert Stainsby" <email@hidden> wrote:
> Hi Jim
>>> Is there an easy way to "drop" admin rights for a postflight script?
>> Using su with the -c flag for the /usr/bin/mdimport command could
>> work.
>
> There doesn't seem to be a -c flag for either su or mdimport. Were you
> thinking of a different flag?
Huh, you are right. I have only used -c on Linux, but I checked my man page
before sending the email. Upon further inspection, it turns out I have a
stale man page, because on Tiger, that option is mentioned in the man page,
on leopord it isn't. My coworkers who did an archive and install vs my
simple upgrade have the newer man page.
Another possibility might be to use the sudo command instead. I actually
tested it this time, since I clearly can't trust my man pages. :)
jkelly-mp:~ root# sudo -u jkelly /bin/echo $PATH > /private/tmp/test
jkelly-mp:~ root# cat /private/tmp/test
/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
So it works. As I said before, the key will be programmatically determining
who the user really is that is executing the script. As I said before, perl
is pretty good for this:
jkelly-mp:~ root# perl -e 'print getlogin()."\n";'
jkelly
Jim
_______________________________________________
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