Re: postflight script on Leopard
site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com Thread-index: AchnQRc1VbEPBNM0EdyRqwAX8gU9wA== Thread-topic: postflight script on Leopard User-agent: Microsoft-Entourage/11.3.6.070618 On 2/4/08 4:52 AM, "Robert Stainsby" <rjsdev@mac.com> 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 (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
James Kelly