On Dec 3, 2007, at 4:30 PM, John Poole wrote: I'm trying to make a package that executes an InstallationCheck script. I can build a package just fine but when I install the package the InstallationCheck script doesn't get called. I'm working with the latest and greatest PackageMaker (3.0.1) from the command line on 10.5.1.
If your finished installer package has a "distribution" file (ie. Foo.pkg/Contents/Foo.dist -- although it could be bar.dist), this is the file that the Installer will run to determine whether the package should install, and which drives should be allowed installation. InstallationCheck and VolumeCheck will be IGNORED. The distribution file has _javascript_ functions embedded in an XML wrapper. Distribution files can be used in packages under Mac OS X 10.4 and later. Earlier Mac OS's ignore distributions.
It is possible for your distribution to call external functions, such as an InstallationCheck file. (I don't think I've ever heard of anyone actually doing it, but it IS possible.) HOWEVER, I strongly suggest that instead of having your distribution call InstallationCheck, just recode the same things in the Distribution script.
How Apple Does It: 1) If the package is only for 10.4 and later, we have an InstallationCheck which returns an error that says, "HEY! 10.4 or later, buddy!", and we have all the real testing in the Distribution. 2) If the package is for older systems AND 10.4, we code the same checks in the InstallationCheck/VolumeCheck and the Distribution. (Yes, it's extra work, we COULD just use the InstallationCheck and VolumeCheck, but there's a smaller chance of users getting their computers trashed if something goes Horribly Wrong.)
If your installer package doesn't have a distribution file, but has "IFRequirements," they will run, not InstallationCheck and VolumeCheck. I am no expert on that format of installation, so I won't comment further on it.
If your installer package doesn't have a distribution, and doesn't have "IFRequirements," the Installer will look for InstallationCheck and VolumeCheck. They have to be in Contents/Resources, have the correct name (be sure to get the case right!), NO extension (check for hidden extension!), and the right owner/permissions.
Assuming this is all good, you can use ANY unix executable for InstallationCheck and VolumeCheck. (These executables must return values that the Installer expects, or things won't go so well.) I am sure that shell scripts, perl, python, and CoreFoundation binary applications all work.
Security Note: The Installer's _javascript_ environment is a "Sandbox" that prevents your package from actually modifying the computer's hard disks until the user clicks "Install." (Same goes for IFRequirements.) If your _javascript_ runs external code, or your installer script relies on InstallationCheck and VolumeCheck to decide stuff, the user will see the "This installer must run code" warning.
The intention of the warning is to let the user know that by clicking OK, they know that the installer may actually change their computer.
Note that until the user supplies an admin password, the Installer is running as the current user sitting at the keyboard, with all the rights and privileges appertaining thereto.... |