Our app needs as little down-time as possible while being updated, for this reason, we are trying the following PKG install procedure:

  • The PKG create a unique folder: /Library/Application Support/<app-name>_Versions/<version>_<N> (where N is a counter, increased for each re-install)
  • The PKG install in that folder
  • The PKG link (symbolic link) the full folder to /Library/Application Support/<app-name> and restart the application.
  • If restarting the application fails, the link is recreated to the previous successful install. So a bugged version should not carry much down time.
  • If successful, the successful install is registered and previous installs deleted.

However, while it is easy to add a pre-script to create the unique folder and a post-script to make the link and start check, I could not find a way to set the PKG target install location in the pre-script.

For example:

pkgbuild --root "<app content>" --install-location="/Library/Application Support/<app-name>" --scripts="<project-scripts>" <target.pkg>

This script will always install to /Library/Application Support/<app-name> and not to the unique folder created by the pre-script. The unique folder is not known at packaging time unfortunately, but only at install time.

How to specify the PKG install target location in the pre-script? Or is there a standard approach to this?

You must log in to answer this question.

Browse other questions tagged .