Re: postflight script on Leopard
site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com 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
On Feb 4, 2008, at 7:17 AM, James Kelly wrote: jkelly-mp:~ root# perl -e 'print getlogin()."\n";' jkelly su $USER -c "touch ~/Desktop/$USER" Thanks all for your help. ====================================== Robert Stainsby Melbourne, Australia Email; Video, voice & text chat (iChat AV/AOL IM): rjsdev@mac.com http://web.mac.com/rjsdev/ _______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... Thanks Jack! Not only did that clarify the role of "-c", but it solves those pesky "cannot execute binary file" messages I was getting. ...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: 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: This also works for running /usr/bin/mdimport, which hopefully solves Geoff's original question. This email sent to site_archiver@lists.apple.com
participants (1)
-
Robert Stainsby