Re: run an application after install
Re: run an application after install
- Subject: Re: run an application after install
- From: Bill Coderre <email@hidden>
- Date: Fri, 30 Apr 2010 12:11:09 -0700
On Apr 30, 2010, at 2:22 AM, Stephane Sudre wrote:
> 2 solutions:
>
> . You don't open the application. You reveal the location of the
> application in the Finder.
>
> . You launch a helper application which will wait for the
> Installer.app process to die before opening the application.
For Apple installers, we sometimes use the second solution above, but for us, it's very complex because we have to take into account Software Update, other installations, and potential restarts.
The one we use is called "Lurk and Launch," but I do NOT advise you copy it and re-use it, because of the above.
If you need additional "INVISICLUES" to solve the puzzle:
1) There's an environment variable called $INSTALLER_TEMP. Use it.
2) Create a perl (or shell, if you really must) script in $INSTALLER_TEMP. Create and run it in the installer postflight script.
3) Make sure your script is world-readable, not world writable, and has the "execute" bit set.
4) The perl script you create should do the following:
a) While "Installer.app" is running, sleep for a second or five
b) "/usr/bin/open" your app.
5) The unix utility "/usr/bin/killall" has an option -s which does not actually send any signals to the app, but it makes finding if an app is running very easy. It's easier than ps.
6) In perl scripts, and in shell scripts, $? returns the "error code" of running the command. But this variable doesn't stay set long!
7) In perl, the error code is non-trivial to check. Read the relevant parts of The Perl Cookbook by Nat Torkington, et all.
8) The best way to open things is to pretend to be the console user, who is named in the environment variable $USER.
9) man su
10) Roughly, su $USER -c '/usr/bin/open -a MyNewApp'
_______________________________________________
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