Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: postflight script on Leopard



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: http://lists.apple.com/mailman/options/installer-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: postflight script on Leopard (From: James Kelly <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.