How to install multiple packages and post-processing?
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:
- Install Other.app to /Applications
- Install Stats.app to /Users/<user>/Applications (see NOTE)
- Install Stats.plist to /Users/<user>/Library/LaunchAgents
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>Post-execute some simple commands:
/Application/Other.app/Contents/MacOS/Other --configure=config.txt
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.
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.
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.
精彩评论