site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=z2na50V6xH3fLguylZ8VleNQyy6Ow6vrnAAXuGVUyOU=; b=gxADku7/i+Dvl/QDbTaR1Tzub6RBIrkwCfuVT4iBBOxtzaw1pio6hTRMkNslwnQH4r V0WtT4Ppgn4P5b9ROo3KbfxDFiNoQ+amz7ggZnVoT4gEwZSnc7ISjPn1AbxVuX9rANjw JjhW109nlY1O7yFBkLzEofsE5CcjgWg7qhYoE= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=aJ4X2zprGhmXgefjfcU5tfF/sYhUtrKvTvBiqNQzN6PnHGZ+mjfA6JctGyXKL1mh/D Cpk03LL9CIV7r5c8ZKG9OI+GH9jtLUXWA6dRCC22r7pTm1Y4dSWdguU+zlKRWctPo42O s67d39nSJcs/wFUIzgc8nT51qWxbsLC9/Bwao= I would be curious to get the Installer.app team's thoughts here; I would think that all the scripts would be getting executed the same way...It kind of makes sense that InstallationCheck is different, but at the same time I'm curious as to the Why. I would avoid tinkering with the HOME path, that could get messy :) Are you still checking for multiple users in your pre/post install scripts? -nick -- Nick Peelman nick@peelman.us On Tue, Mar 16, 2010 at 2:29 PM, Xochitl Lunde <Xochitl_Lunde@tripplite.com> wrote:
On Tue, Mar 16, 2010 at 11:32 AM, Xochitl Lunde <Xochitl_Lunde@tripplite.com> 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 <Xochitl_Lunde@tripplite.com> 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 (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