Re: Struggles with PackageMaker and Iceberg scripts
site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com _______________________________________________ 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
Why aren't you just installing the launchd agent in /Library/
LaunchAgents ?
This way you don't have to know or care who is currently logged in,
and it will work for all users (current and future) of the machine.
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.
sudo shouldn't give you a second user via a "who" command. But a
Terminal window (or multiple terminal windows) will:
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.
When you run it from a command line what your script is seeing is the
console session and the tty session. When run via ARD, if no users
are logged in, that script should run fine (but I still suggest
testing it). 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. : /
Short of building an array based on the awk $1 of the who command, my
only other suggest would be to grep for "console" between your who and
your awk, ie:
who | grep console | awk ' { print $1 } '.
-nick
--
Nick Peelman
nick@peelman.us
On Mon, Mar 15, 2010 at 5:37 PM, Xochitl Lunde
<Xochitl_Lunde@tripplite.com> wrote:
Thanks to some of the earlier discussions here, I have a package which I
feel works fantastically with my launchd items. Unfortunately, it now does
not work for me on the command line, oops!
xochitl-lundes-imac:installcomponents xlunde$ installer -pkg
sda/iceberg/build/PowerAlertSA-12.04.0050.pkg -target /Volumes/SNOWLEOPARD
Java Update version is '1'.
installer: This package requires authentication to install.
xochitl-lundes-imac:installcomponents xlunde$ sudo installer -pkg
sda/iceberg/build/PowerAlertSA-12.04.0050.pkg -target /Volumes/SNOWLEOPARD
xlunde is logged in!
installer: Error - Too many users are logged in. PowerAlert cannot be
installed correctly for all users when multiple users are logged in.
-----------------------
Obviously, I did this to myself.
for name in `who | awk {'print $1'}`
do
if [ ! $name = $USER ] ; then
echo "${name} is logged in!"
exit 112;
fi
done
participants (1)
-
Xochitl Lunde