Quote:
Originally Posted by pdurrant
You need to use two zip commands. One to add the mimetype, uncompressed, and then one to add the other files.
zip -X0 <quoted form of ePubFilePath> mimetype
zip -rDX9 <quoted form of ePubFilePath> * -x "*.DS_Store" -x mimetype
|
In practice, that's completely unnecessary on OS X. The following produces identical results:
Code:
zip -Xr9D /path/to/filename.epub mimetype * -x .DS_Store
If you dig through OS X's zip source code (it is open source), you'll see that unless you either A. pass the -Z flag to force a particular compression method or B. pass the -0 flag to disable compression entirely, the OS X zip tool defaults to "BEST" mode, which means that it uses either STORE (uncompressed) or DEFLATE (compressed), depending on which would produce a smaller file.
Because the mimetype file's contents are so short, it gets larger when compressed with DEFLATE. Therefore, OS X's zip implementation will always store it using STORE rather than DEFLATE.
Your mileage may vary with other zip implementations.