I want to build an apple installer .pkg where I run a postinstall script after the files have been copied by the installer. The script is run and everything works perfect except that all the commands in the script are run as root.
The question is, how can I determine the id of the user who actually invoked the installer.
who -m
returns the invoking user when I run the script on the command line with sudo
. But it returns root
when I run it in the installer.
Is there any way to get the "actual user"?
Thanks for your help!