Re: postflight script on Leopard
Re: postflight script on Leopard
- Subject: Re: postflight script on Leopard
- From: Robert Stainsby <email@hidden>
- Date: Tue, 5 Feb 2008 21:31:24 +1100
On 05/02/2008, at 7:35 AM, Jack Repenning wrote:
So, for example,
> su notme -c 'sleep 10'
Password:
... sleeps for 10 seconds, but this simply fails:
> su notme sleep 10
Password:
/bin/sleep: /bin/sleep: cannot execute binary file
Thanks Jack! Not only did that clarify the role of "-c", but it solves
those pesky "cannot execute binary file" messages I was getting.
On Feb 4, 2008, at 7:17 AM, James Kelly wrote:
...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
It seems that $USER always represents the non-root user who initiated
the installer, even if it is running with admin/root privileges. So,
for example, the following postinstall script works fine for me,
creating a file with the name of that user on their Desktop:
su $USER -c "touch ~/Desktop/$USER"
This also works for running /usr/bin/mdimport, which hopefully solves
Geoff's original question.
Thanks all for your help.
======================================
Robert Stainsby
Melbourne, Australia
Email; Video, voice & text chat (iChat AV/AOL IM): email@hidden
http://web.mac.com/rjsdev/
_______________________________________________
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