I need to zip up a .app bundle automatically from a shell script, and was wondering how to do that.
After reading the zip man I still don't understand the syntax to zip up foo.app.
Could someone point me in the right direction please.
Caius.
mark hunte
03-20-2006, 01:10 PM
I had the same problem the other day.
zip -r zipname.zip bundled.app/
I had to cd to the folder the app was in.
the -r is a recursive option which you need for the bundle.
But if I do not cd to the folder and put the full path to the app.
Users/Usernam/Desktop/bundled.app
using the -r option gave me a zip with a folder hierarchy with Users/Usernam/Desktop/bundled.app
Hence cd to the containing folder first.
Others may tell us how to do it better.
iNemo
03-20-2006, 01:16 PM
Thanks!
A simple
cd foo/bar && zip -r foo.zip foo.app/ && cd ../../
should work for me!
mark hunte
03-20-2006, 01:22 PM
Are the && the same as ; but they wait for completion?
hayne
03-20-2006, 01:34 PM
Are the && the same as ; but they wait for completion?
See this: http://www.tldp.org/LDP/abs/html/list-cons.html#LISTCONSREF
hayne
03-20-2006, 01:37 PM
using the -r option gave me a zip with a folder hierarchy with Users/Usernam/Desktop/bundled.app
Hence cd to the containing folder first.
Others may tell us how to do it better.
I haven't tried it, but it looks like maybe the "-j" option will do what you want.
I.e. try:
zip -rj
mark hunte
03-20-2006, 01:45 PM
Thanks Hayne..
using the -rj does indeed get ride of the directories.
But in a application bundle app you need them. (imagine show package contents)
What the problem was it, with out cd-ing to the container of the app.
you got all the directories above it included (empty).
You had to drill down to find you application bundle.
You can also do something like the following. In my tests, it seems to create a standard double-clickable OS X zip archive.ditto -c -k --sequesterRsrc --keepParent /Applications/MyApp.app/ /Applications/MyApp.zip