Re: Struggles with PackageMaker and Iceberg scripts
Re: Struggles with PackageMaker and Iceberg scripts
- Subject: Re: Struggles with PackageMaker and Iceberg scripts
- From: Xochitl Lunde <email@hidden>
- Date: Tue, 16 Mar 2010 13:29:11 -0500
- Importance:
- Sensitivity:
On Tue, Mar 16, 2010 at 11:32 AM, Xochitl Lunde
<email@hidden> wrote:
If I use 'sudo' to run the installer on the
> command line, the $USER parameter is set to 'root' instead. Because my
> script checks for users logged in who are not $USER, I get the error.
Yeah, that's what I get for opening my mouth/keyboard without testing
first. When sudo is invoked, it sets several variables as well,
including $SUDO_USER which should contain the username of the user who
invoked it. You may have to do an else if in your bash to handle
that.
XO: I just tried this out, and it only works in the InstallationCheck script. I think it's pretty interesting, so I made all my scripts print out their environment. Only the InstallationCheck script gets the SUDO_USER variable, have a look! Do you think this is a bug? I wrote some kind of weird stuff to guess the name of the user from the HOME path, but I haven't decided yet if that's a bad idea.
xochitl-lundes-imac:installcomponents xlunde$ sudo installer -verbose -dumplog -pkg sda/iceberg/build/PowerAlertSA-12.04.0050.pkg -target /Volumes/SNOWLEOPARD
----INSTALLATIONCHECK----
SHELL=/bin/bash
TERM=xterm-color
USER=root
COMMAND_MODE=legacy
SUDO_USER=xlunde
SUDO_UID=501
SCRIPT_NAME=InstallationCheck
SSH_AUTH_SOCK=/tmp/launch-KwW0dY/Listeners
__CF_USER_TEXT_ENCODING=0x0:0:0
USERNAME=root
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
PWD=/Users/xlunde/code/proj/pa49x64/engine/leopard/installcomponents
LANG=en_US.UTF-8
PACKAGE_PATH=/Users/xlunde/code/proj/pa49x64/engine/leopard/installcomponents/sda/iceberg/build/PowerAlertSA-12.04.0050.pkg
SHLVL=1
SUDO_COMMAND=/usr/sbin/installer -verbose -dumplog -pkg sda/iceberg/build/PowerAlertSA-12.04.0050.pkg -target /Volumes/SNOWLEOPARD
HOME=/Users/xlunde
LOGNAME=root
COMMAND_LINE_INSTALL=1
SUDO_GID=20
DISPLAY=/tmp/launch-abhWeL/:0
_=/usr/bin/env
-------------------------
installer[3604]: ./preupgrade: -------PREINSTALL--------
installer[3604]: ./preupgrade: INSTALLER_TEMP=/private/tmp/PKInstallSandbox.4vAbAd/tmp
installer[3604]: ./preupgrade: DSTVOLUME=/
installer[3604]: ./preupgrade: TMPDIR=/private/tmp/PKInstallSandbox.4vAbAd/tmp
installer[3604]: ./preupgrade: DSTROOT=/
installer[3604]: ./preupgrade: DYLD_NO_FIX_PREBINDING=YES
installer[3604]: ./preupgrade: USER=root
installer[3604]: ./preupgrade: SCRIPT_NAME=preupgrade
installer[3604]: ./preupgrade: __PARENT_INSTALL_SANDBOX=/var/folders/zz/zzzivhrRnAmviuee+++++++++++/-Tmp-/PKInstallSandbox-tmp
installer[3604]: ./preupgrade: SHARED_INSTALLER_TEMP=/var/folders/zz/zzzivhrRnAmviuee+++++++++++/-Tmp-/PKInstallSandbox-shared-tmp
installer[3604]: ./preupgrade: INSTALLER_SECURE_TEMP=/var/folders/zz/zzzivhrRnAmviuee+++++++++++/-Tmp-/PKInstallSandbox-tmp/Secure_Temp.1364844149
installer[3604]: ./preupgrade: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec
installer[3604]: ./preupgrade: RECEIPT_PATH=/Users/xlunde/code/proj/pa49x64/engine/leopard/installcomponents/sda/iceberg/build/PowerAlertSA-12.04.0050.pkg/Contents/Resources
installer[3604]: ./preupgrade: PWD=/private/tmp/PKInstallSandbox.4vAbAd/tmp
installer[3604]: ./preupgrade: INSTALL_PKG_SESSION_ID=com.tripplite.poweralert.PowerAlertEngineSA.pkg
installer[3604]: ./preupgrade: LANG=en_US.UTF-8
installer[3604]: ./preupgrade: PACKAGE_PATH=/Users/xlunde/code/proj/pa49x64/engine/leopard/installcomponents/sda/iceberg/build/PowerAlertSA-12.04.0050.pkg
installer[3604]: ./preupgrade: SHLVL=1
installer[3604]: ./preupgrade: HOME=/Users/xlunde
installer[3604]: ./preupgrade: COMMAND_LINE_INSTALL=1
installer[3604]: ./preupgrade: _=/usr/bin/env
installer[3604]: ./preupgrade: -------------------------
installer[3604]: ./postupgrade: -----POSTINSTALL----
installer[3604]: ./postupgrade: INSTALLER_TEMP=/private/tmp/PKInstallSandbox.4vAbAd/tmp
installer[3604]: ./postupgrade: DSTVOLUME=/
installer[3604]: ./postupgrade: TMPDIR=/private/tmp/PKInstallSandbox.4vAbAd/tmp
installer[3604]: ./postupgrade: DSTROOT=/
installer[3604]: ./postupgrade: DYLD_NO_FIX_PREBINDING=YES
installer[3604]: ./postupgrade: USER=root
installer[3604]: ./postupgrade: SCRIPT_NAME=postupgrade
installer[3604]: ./postupgrade: __PARENT_INSTALL_SANDBOX=/var/folders/zz/zzzivhrRnAmviuee+++++++++++/-Tmp-/PKInstallSandbox-tmp
installer[3604]: ./postupgrade: SHARED_INSTALLER_TEMP=/var/folders/zz/zzzivhrRnAmviuee+++++++++++/-Tmp-/PKInstallSandbox-shared-tmp
installer[3604]: ./postupgrade: INSTALLER_SECURE_TEMP=/var/folders/zz/zzzivhrRnAmviuee+++++++++++/-Tmp-/PKInstallSandbox-tmp/Secure_Temp.2131041415
installer[3604]: ./postupgrade: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec
installer[3604]: ./postupgrade: RECEIPT_PATH=/Users/xlunde/code/proj/pa49x64/engine/leopard/installcomponents/sda/iceberg/build/PowerAlertSA-12.04.0050.pkg/Contents/Resources
installer[3604]: ./postupgrade: PWD=/private/tmp/PKInstallSandbox.4vAbAd/tmp
installer[3604]: ./postupgrade: INSTALL_PKG_SESSION_ID=com.tripplite.poweralert.PowerAlertEngineSA.pkg
installer[3604]: ./postupgrade: LANG=en_US.UTF-8
installer[3604]: ./postupgrade: PACKAGE_PATH=/Users/xlunde/code/proj/pa49x64/engine/leopard/installcomponents/sda/iceberg/build/PowerAlertSA-12.04.0050.pkg
installer[3604]: ./postupgrade: SHLVL=1
installer[3604]: ./postupgrade: HOME=/Users/xlunde
installer[3604]: ./postupgrade: COMMAND_LINE_INSTALL=1
installer[3604]: ./postupgrade: _=/usr/bin/env
installer[3604]: ./postupgrade: --------------------
On Tue, Mar 16, 2010 at 11:32 AM, Xochitl Lunde
<email@hidden> wrote:
> XO: I do install the plist in /Library/LaunchAgents. The reason that I care
> is that if either of our programs is running when the installer runs, I have
> to stop the program before installing again. This doesn't work nicely if
> other users are logged in because I can't stop the agent for them also.
Admittedly, this is an edge case, how many users would be using Fast
User Switching to have a second console user, but its still a case
that should be handled.
> XO: It doesn't give me an extra user. What happens is that when the
> Installer GUI is used to install the package, the $USER environment variable
> is set as my user, 'xlunde'. If I use 'sudo' to run the installer on the
> command line, the $USER parameter is set to 'root' instead. Because my
> script checks for users logged in who are not $USER, I get the error.
>
> My post install scripts also try to start the launch agent for the $USER, so
> this might work weird or not at all if 'root' is the $USER.
Yeah, that's what I get for opening my mouth/keyboard without testing
first. When sudo is invoked, it sets several variables as well,
including $SUDO_USER which should contain the username of the user who
invoked it. You may have to do an else if in your bash to handle
that.
> XO: I don't have ARD that I know of, and it doesn't look like it's free.
> This software is going to an external testing house later, so they'll have
> to test that. : /
I could run a few test cases for you with ARD, if you wanted. Ping me offlist.
-nick
_______________________________________________
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