Re: Quitting applications on InstallationCheck
Re: Quitting applications on InstallationCheck
- Subject: Re: Quitting applications on InstallationCheck
- From: Bill Coderre <email@hidden>
- Date: Mon, 23 Jul 2007 14:27:47 -0700
On Jul 23, 2007, at 12:10 PM, Fritz Anderson wrote:
On 19 Jul 2007, at 5:51 PM, Bill Coderre wrote:
Apple's policy (which is not followed 100%) is to put up an error
immediately if the target app is running. To do this, check for
the app running in your InstallationCheck script (or similar part
of the distribution script), and just return an error. This means
that the user has to switch to the other app, save and close, quit
the installer, and then re-run the installer. That's a bit lame...
Thank you, Bill, for the background and help.
As an experiment, I've tried including, as InstallationCheck, a
Foundation/CF/Carbon tool that, if it finds the target application
running, posts a CFUserNotification alert asking the user to quit
the target and press Continue, or to press Cancel to abandon the
installation.
I get the "This package contains a program..." alert, but probably
it can't be helped, and it's a policy issue as to whether we can
live with it.
What does my tool return, if the user presses Cancel? I tried 3,
and found that the installation continued unimpeded. I tried 96 + 3
= 99, and Installer.app crashed, I assume because it couldn't find
a matching message string, and didn't check to see if the message
was NULL.
Am I going astray here?
Your unix executable should return an InstallationCheck error code
byte. This is documented somewhere, but here's the quick explanation.
The real documentation should be considered to be more accurate than
mine.
Start with 8 bits of 0, and set the number of the error message to be
returned.
If you set a number from 1 - 15, you get a predefined error message.
They are currently set as follows:
1 - Displays message "This software cannot be installed on this
computer."
2 - Displays message "The software <blah> cannot be installed on
this computer."
3 - Displays message "<blah> cannot be installed on this computer."
4 - Displays message ""An error was encountered while running the
InstallationCheck tool for package <blah>."
5 - Displays message about how your system has Tier3, so
you can't install. (Tiger and later, only)
6-15 Additional predefine messages supplied by the Installer
(currently undefined).
If you specify a value from 16 - 31, the error is looked up in
InstallationCheck.strings, in an appropriate lproj as necessary for
localization. Here's an example of such a file:
"16" = "Mac OS XI is required for installation.";
"17" = "There is already a newer version of this software on this
system.";
"18" = "Please quit the program Foo and try your installation again.";
Then set bits 6 and 5 as follows:
Bit 6 Bit 5 Meaning
0 0 Success - Installation to proceed as normal
0 1 Warning - Present the user a warning panel and allow install
to proceed.
1 0 Fail Silently - Current package is skipped without showing any
feedback.
1 1 Fail installation with error message shown.
Note that the "warning" and "fail silently" modes do not work
consistently in all installation situations. For instance, "fail
silently" probably only operates as expected when the package is part
of a bigger mpkg. [I can't recall all the details, and the results
may vary between 10.1 and 10.3.9. (10.4 and later should work the
same as 10.3.9. If your software is to support 10.2 and later, I'd
make your installer support ONLY 10.2.8, 10.3.9, and 10.4.10 and
later, if possible. That will make life a lot simpler.)]
Bit 8 is reserved and must always be 0.
Most likely, you will already know that you want to the installer to
stop, throw up an alert, and show string #17 (say), so your
InstallationCheck executable would return 32 + 16 + 17.
Note also that if you have a standard unix executable, which returns
0 on noError and >0 on error, and you wish to wrap it up and use it
in a typical perl InstallationCheck, you'll need to call perl's
"system" call roughly as follows:
system($ARGV[0] . "/Contents/Resources/unixCheck", ... ); # Add
any command line args
my $result = $? >> 8;
if ($result) {
$EXIT_VALUE = ( ( 1 << 6 ) | ( 1 << 5 ) | 18 ); # always stop
with error 18
last;
}
The first argument of the system call is the path to the executable,
and $ARGV[0] in perl is the path to the installer package in
question. I put my executables in Contents/Resources. perl's "system"
call is a bit strange, since the return code is offset by 8. Read up
on this if you're not familiar with the details.
_______________________________________________
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