Lion and Mountain Lion include a new Terminal command to allow creating package files that only contain a script.
To do this, make a Scripts folder and place a “postinstall” script inside this folder. This needs to be a Bash script with #!/bin/bash as the first line.
Next, run the following command to create the package file:
sudo pkgbuild –identifier com.your.id –nopayload –scripts /path/to/scripts/folder /path/to/save/package/name.pkg