• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Environment variable availability within post-install script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Environment variable availability within post-install script


  • Subject: RE: Environment variable availability within post-install script
  • From: Adam Peck <email@hidden>
  • Date: Mon, 10 May 2010 07:48:34 -0600
  • Acceptlanguage: en-US
  • Thread-topic: Environment variable availability within post-install script

The $USER environment variable will always be the logged in users short name. It is the same as running 'sudo echo $USER'.

-Adam

-----Original Message-----
From: installer-dev-bounces+adampeck=email@hidden [mailto:installer-dev-bounces+adampeck=email@hidden] On Behalf Of Iceberg-Dev
Sent: Sunday, May 09, 2010 4:14 PM
To: Installer-Dev mailing-list
Subject: Re: Environment variable availability within post-install script


On May 9, 2010, at 8:10 PM, Tim Streater wrote:

> My post-install script (written in PHP) must write a file on the
> user's desktop, and so needs the user's shortname in order to
> construct the path. The script also modifies the apache config file
> and so needs admin priv. I appear to be able to give it that by
> ticking "Require admin authentication".
>
> In my PHP, I appear to be able to do:
>
> $user = getenv ("USER");
>
> to have the logged-in user's name. This seems unexpected to me, I
> would have thought that I would get "root", if anything at all. It
> also seems at variance with the documentation that lists the
> environment variables available to the scripts. Can I rely on what
> I've done or is there a better way of getting the user's shortname?

I didn't know you could use PHP code in a post-install script but
that's the correct environment variable.
 _______________________________________________
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


 _______________________________________________
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

References: 
 >Environment variable availability within post-install script (From: Tim Streater <email@hidden>)
 >Re: Environment variable availability within post-install script (From: Iceberg-Dev <email@hidden>)

  • Prev by Date: One way installl dependencies
  • Next by Date: Re: Environment variable availability within post-install script
  • Previous by thread: Re: Environment variable availability within post-install script
  • Next by thread: Re: Environment variable availability within post-install script
  • Index(es):
    • Date
    • Thread