An EPUB is just a ZIP container, but using a ZIP tool directly on a directory with content documents won't usually result in a valid EPUB. This is because the standard requires that:
- The mimetype resource must appear as the first file in the container
- The mimetype resource must be uncompressed
So to meet these requirements we must ZIP the files in a special way. This gist describes how to do this with InfoZip (which is the default ZIP tool on most Linux systems).
Let's suppose all content files are in a directory called /home/johan/epubPolicyTests/content/epub20_minimal/
.
cd /home/johan/epubPolicyTests/content/epub20_minimal/
zip -X0 /home/johan/epubPolicyTests/build/epub20_minimal.epub mimetype
zip -rDX9 /home/johan/epubPolicyTests/build/epub20_minimal.epub * -x mimetype
epubcheck /home/johan/epubPolicyTests/build/epub20_minimal.epub
Done!
Adapted from http://www.mobileread.com/forums/showpost.php?s=5ebefd2d1551601ab91386c12853dfc6&p=581649&postcount=1