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: Mon, 29 Mar 2010 15:41:44 -0500
- Importance:
- Sensitivity:
Another disappointing thing I've just discovered is that the INSTALL_PKG_SESSION_ID doesn't seem to get set in my Leopard environment. This causes my individual packages to fail because they are using that variable to determine which product was installed. Can anyone recommend if any of the variables which DO get set are fair game for use in determining which package is being installed? I could parse out the name of the path or receipt, but what if someone renames the name of the package?
------------------------ LEOPARD ENV FROM POSTINSTALL -----------------------
3/29/10 3:12:41 PM runner[377] postinstall[391]: INSTALLER_TEMP=/private/tmp/PowerAlertSA-12.04.0050.pkg.355yyRScZ
3/29/10 3:12:41 PM runner[377] postinstall[391]: TMPDIR=/private/tmp/PowerAlertSA-12.04.0050.pkg.355yyRScZ
3/29/10 3:12:41 PM runner[377] postinstall[391]: DYLD_NO_FIX_PREBINDING=YES
3/29/10 3:12:41 PM runner[377] postinstall[391]: USER=xlunde
3/29/10 3:12:41 PM runner[377] postinstall[391]: COMMAND_MODE=legacy
3/29/10 3:12:41 PM runner[377] postinstall[391]: SCRIPT_NAME=postinstall
3/29/10 3:12:41 PM runner[377] postinstall[391]: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec
3/29/10 3:12:41 PM runner[377] postinstall[391]: RECEIPT_PATH=/tmp/PowerAlertSA-12.04.0050.pkg.355yyRScZ/Receipts/PowerAlertSA-12.04.0050.pkg/Contents/Resources
3/29/10 3:12:41 PM runner[377] postinstall[391]: PWD=/
3/29/10 3:12:41 PM runner[377] postinstall[391]: PACKAGE_PATH=/Volumes/SNOWLEOPARD/Users/xlunde/code/proj/pa49x64/engine/leopard/installcomponents/sda/iceberg/build/PowerAlertSA-12.04.0050.pkg
3/29/10 3:12:41 PM runner[377] postinstall[391]: SHLVL=1
3/29/10 3:12:41 PM runner[377] postinstall[391]: HOME=/Users/xlunde
3/29/10 3:12:41 PM runner[377] postinstall[391]: _=/usr/bin/env
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: --------------------
_______________________________________________
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