I have an app I need to create an installer for, and all the installer needs to do (besides copying the app) is run a script (or executable) that is not part of the app itself. Any help on how I can do this? I see in the Requirements tab there is a Results of Script action, and there is also the Preinstall Actions in the Actions tab which has an Open File action. Will either of these do the job or should I be looking elsewhere?
Here is a good How-to
There are 7 types of scripts than can be launched during the Installation Process:
InstallationCheck: This script is launched at the beginning of the installation process (even before the Authentication step). It can be used to check that the Package can be installed on this computer.
VolumeCheck: This script is launched in the "Select Destination" step. It is used to determine on which volume the Package can be installed.
preflight: This script is launched just after the user clicked on the "Install" button.
preinstall / preupgrade: This script is launched after the preflight script if there's one (in the case of a single package installation); otherwise just after the user clicked on the "Install" button.
As you see, there's 2 types of scripts here. The preinstall one is launched when the Package has never been installed (from an Installer.app point of view), the preupgrade one is launched when the Package has already been installed. To determine whether a Package has already been installed or not, Installer.app is having a look at the content of the following directory: /Library/Receipts. If there's a file named PackageName.pkg within it, then the Package has already been installed, otherwise it's the first install.
postinstall / postupgrade: This script is launched after the files in the package have been installed. See (preinstall / preupgrade) to see which one is launched.
postflight: This script is launched after the postinstall / postupgrade script or when the package has been installed.
This PackageMaker How-To article is out of date, but it has some very useful info on scripts about half-way down. Look for the table showing the command line variables as seen from shell and perl, plus some useful exit status values.
Did you find a solution for your problem? I'm using PackageMaker 3.0.4 provided with XCode 3.2.4 and I have the same problem.
I just managed to include a Shell script to my package that I made with PackageMaker. I needed to add my app to the login items after installation, so I made a script called postflight.sh and put it in just a folder. (It seems it works with any location)
And then in my package, I have Applications. In Contents, Package:Applications, in the Scripts tab, I choose the postflight.sh in Postflight section. That's it.
my postflight.sh starts with
#!/bin/bash
and then it has some script to put the app into the login items. When I didn't have that, I could make the package, but the installation failed. Hope this is helpful.
Joon