3

I find myself in a unique scenario -- it has to be, because no searching I do seems to turn up any answers. But maybe there's a MacOS X guru out there that can answer this for me?

I'm using PackageMaker to create an install process for my company's application. It's a cross-platform app and my home base is Linux and Windows, so please forgive my MacOS X un-intellect.

We've got two software bundles -- er, apps. One is Other.app, which is developed by an external company which we are "bundling" our software with. Our app is Stats.app. Our app will run as a launch agent, so correspondingly I have a .plist file that works when I install by hand in the terminal.

My goals of the install process are this:

  1. Install Other.app to /Applications
  2. Install Stats.app to /Users/<user>/Applications (see NOTE)
  3. Install Stats.plist to /Users/<user>/Library/LaunchAgents
  4. Post-process Stats.plist to modify the "ProgramArguments" key so that the path is correct:

    <array>
    <string>%{HOME}/Applications/Stats.app/Contents/MacOS/Stats</string>
    </array>

  5. Post-execute some simple commands:

    /Application/Other.app/Contents/MacOS/Other --configure=config.txt

  6. Check exit codes, and if all is good, tell the user we're finished.

I'm hoping -- no...praying! -- that someone how there has information for how this can be done.

To clarify, it's not a requirement that Stats.app be in the users home directory. It is a requirement that the Launch agent is in the home directory since Stats.app requires a running Carbon to operate.

kenorb
  • 155,785
  • 88
  • 678
  • 743

2 Answers2

0

You could try a bash script that would install the apps to the directory desired and in the script use sed to do the modification of the Stats.plist file.

Paul Cav
  • 50
  • 3
0

Use the post-install/post-upgrade scripts for each package to do your rewriting. Different versions of PackageMaker look different, and which systems you're targeting also affect the UI, so poke around.

I'm convinced Apple created PackageMaker as a hair shirt for developers targeting their platform, because life was just too easy and good with Interface Builder, Cocoa, and Xcode. Good luck!

Also: Don't trust it to handle permissions correctly; have your post-install/post-upgrade scripts (generally the same script set for both) go through and chmod and chown your files. No need for sudo, you're already running as root.

Also also: PackageMaker can't handle installing a directory structure that includes symlinks to directories that create a cycle. This includes some frameworks distributed by Apple, such as the DotMacKit.

Jeremy W. Sherman
  • 35,901
  • 5
  • 77
  • 111
  • So how do I get PackageMaker to install Other.app to / and Stats.app to /Users/user ? What language is the script in? bash script? – optionsanarchist Oct 29 '10 at 16:47
  • You can configure the installation target directory for each package using the PackageMaker UI. It's setting ownership, permissions, ACLs, and rewriting the plist that you'll really need the post-install/upgrade scripts for. Those can be in whatever language you want; they're just executed as programs, so with the right hash-bang line, you're good to go. – Jeremy W. Sherman Oct 29 '10 at 16:50