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:
- Is there an explanation why the .app file is only copied once?
- Is this the best way to package multiple file types? I have the feeling that placing it in the /tmp folder is unnecessary. By default the package files are being placed in some kind of installer /tmp folder, right? Can't this be the working directory from which the postinstall script will run?