I am trying to create an installer for a Java app on Mac OS 10.8.4. The app runs fine, and I can install it without a hitch from a zip file. I can create a .pkg installer with either productbuild or pkgbuild. I can also install either of the installer .pkg file successfully, however the app does not run properly due to the fact that both packaging programs change the ownership of a data directory and its subordinate files and subdirectories from user to root. I install this data directory in the Resources directory of the .app bundle, and the first time the program executes, it moves the data directory to /Users/user/Library/Application Support. I tried using the --ownership preserve and --ownership preserve-other options with pkgbuild to no avail. The only way I have been able to install and execute properly is via the zip file, since it leaves file ownership alone. Here is the pkgbuild command I am using:
pkgbuild --ownership preserve --component ./myApp.app ./myApp-installer.pkg
My questions are:
How can I force pkgbuild to honor my --ownership preserve option?
Is it possible to build a separate data-only package with user ownership and destined for the user area and merge it with the executable package via the --synthesize option of pkgbuild? if yes, could someone show me how to build such a data-only package?
I know it is quite old, I'll just answer in case someone else needs the answer. What I usually do, is that I have a shell script which creates the .pkg file for me. In that script I set all the file permissions and ownership before packaging. Here is an example:
save this something in a file like create-my-package.sh and run this in command line.