Right now, I want to package two apps and one script in one installer. (the script file is to do some postinstall things.)

HelloWorld.app, HelloHelper.app, and postinstall text file ( shell commands ) (no .txt) (script file is under /Script)

 

There are several steps to do it.

1. sign your app with commands if you don't sign in Xcode, like :

codesign -f -v -s "3rd Party Mac Developer Application: Izik Pte Ltd" "HelloWorld.app"

2. then use pkgbuild to build .pkg for each app, like:

pkgbuild --component "HelloWorld.app" \
--identifier "com.izik.HelloWorld" \
--version "1.0.0" \
--install-location "/Applications" \
"HelloWorld.pkg"

3. for the script part. use chmod command to make the script executable

chmod a+x /postinstall

4. build nopayload package. like:

pkgbuild --identifier com.izik.HelloScript --nopayload --scripts ./Scripts "HelloScript.pkg"

5. get Distribution.xml from three .pkg files..

productbuild --synthesize \
--package HelloWorld.pkg --package HelloHelper.pkg --package HelloScript.pkg \
Distribution.xml

6. use productbuild to package all into one installer

productbuild --distribution ./Distribution.xml \
--package-path . \
./HelloInstaller.pkg

7, last step is to sign with installer ID.

productsign --sign "Developer ID Installer: Izik Pte Ltd" \
"./HelloInstaller.pkg" "./HelloIzikInstaller.pkg"

 

 

At last, before you upload your installer into appstore, you can test it using the following command:

sudo installer -store -pkg HelloIzikInstaller.pkg -target / 

 

This will simulate the installing process through Mac appstore.

 

 

usefull links:

http://hartcw.com/francis/building-for-the-mac-app-store/

http://stackoverflow.com/questions/8038788/mac-app-store-productbuild

http://derflounder.wordpress.com/2012/08/15/creating-payload-free-packages-with-pkgbuild/

posted on 2013-04-11 14:21  HeeZee CG Blog  阅读(499)  评论(0编辑  收藏  举报