So I'm packaging a printer tool for our company consisting two .pkg files (drivers) and an .app file.
Right now I'm using the following command to build the package:
pkgbuild --root ./content --script ./scripts --identifier com.MyGreatCompany --version 0.1 --install-location /tmp/ ./PrinterTool.pkg
So when installing the package all content is placed in the /tmp/ directory. A postinstall script then completes the installation like this:
installer -verbose -pkg /private/tmp/PackageOne.pkg -target /
installer -verbose -pkg /private/tmp/PackageTwo.pkg -target /
/bin/rm -rf /Applications/Utilities/PrinterTool.app
/bin/mv -f /private/tmp/PrinterTool.app /Applications/Utilities/PrinterTool.app
This kind of works. The first install attempt goes well, but when I'm trying to re-install the same package things go wrong. The .app file is not copied to the /tmp folder and thus not moved to the Utilities folder.
So i'd like to know two things:
Yeah... you don't want to do it this way :D
First, of you don't need to create the subpackages, just don't. You can have several bundles in the same pkg file. Use the --components
flag to define them (or create a Components Property List). Build your entire file system inside of your rootdir. So in your case you'd have:
.../content/Applications/Utilities/PrinterTool.app
.../content/Library/...wherever.../driver-whatever.
Then your --install-location
is just /
.
If you really need multiple packages (or if it's just more convenient), then you want to use productbuild
to combine them. You can pass multiple --package
options to create a multi-package installer.