3

I want to (periodically and automatically) create an installer from various files and folders that are in many places. But, I can't figure out how to supply the packagemaker command with all the paths of the items I want to install.

This is for internal development purposes, not for customer distribution. I want the files included to be configureable; it's not really an option to use the GUI to add all the paths because they will change frequently.

The best I could do was to use the --watch flag and touch all of the stuff I wanted included in the package. This is very messy and includes other files that happen to be accessed at the same time. There isn't a common scheme to what I want to include, so I can't just --filter the rest out.

Ideally, I would just give it a file full of paths and it would build the package. If that's not an option, I'm not averse to generating XML or putting them on the command line or whatever will work. I probably have ~30 files I want in the installer, but that number will probably grow.

Is there a better way to do this? Am I missing the point?

edit: Figured that I can copy all the files I want in the package into a directory and then use the --root flag. Is that the best way to do it?

edit 2: Is there a way to do it with symlinks, so I don't have to copy the files before?

zekel
  • 9,227
  • 10
  • 65
  • 96
  • where is the command line PackageMaker? I only find PackageMaker.app – yairchu May 30 '10 at 21:00
  • 3
    nm. I found out the answer (`/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker --help`) – yairchu May 30 '10 at 21:23
  • @zekel - can you post an answer for this, with the command-line options you used? – petert Oct 12 '11 at 17:16
  • @petert - I posted an answer, let me know if that doesn't help. – zekel Oct 21 '11 at 19:26
  • Note: PackageMaker is apparently deprecated: http://stackoverflow.com/questions/11487596/making-os-x-installer-packages-like-a-pro-xcode4-developer-id-mountain-lion-re/11487658#11487658 – zekel Sep 12 '12 at 14:23

1 Answers1

1

(I'm not marking this answer as accepted because I'd really like to be able create the installer from files in different locations without having to copy them to a staging directory.)

As requested by petert, here's how you create the installer from files in a directory. Note that this isn't exactly what I wanted, since it adds all the files in the directory. (And I only wanted to include some specific files.)

## create the fake root directory (which is also the name of the .pkg installer created)
## paths below this will be interpreted as absolute when the installer runs
mkdir -p MyInstaller

## create some fake stuff to install
install_to="MyInstaller/$HOME/installed_dir/"
mkdir -p "$install_to"
echo 'it worked!' > "$install_to/test.txt"

## actually create the installer
/Developer/usr/bin/packagemaker -i com.mycompany.myInstallerName --root MyInstaller

Note that you have to provide a bundle identifier with the -i option (or provide a plist.)

zekel
  • 9,227
  • 10
  • 65
  • 96
  • Thanks zekel. Actually I figured-out that if you put all your files in say /tmp/mypackage, then use this absolute path in the pmdoc, when you run packagemaker on the command-line it'll work as expected. – petert Oct 24 '11 at 09:06
  • I agree, it's a bit untidy that you have to create a 'staging' folder for all the files that must be added to the package, but it works responsibly well; and Apple aren't going to develop the PackageMaker app further with the App Store existing now. The light-bulb moment was realising that you simply create a package (pmdoc) doc file with the 'staging' folder, then you can re-use this file to create new versions with any files you staged. – petert Oct 26 '11 at 08:50