Is there really a way to use zip on the command line to create an epub file that validates properly with epubcheck? I have tried every sequence of command line commands that I can find on the Internet and they all say they work, but I get exactly the same errors no matter how I do it. I suspect that the people who claim that zip creates valid epub files have not validated them with epubcheck. The files this method creates seem to work on a few ereaders, but not all of them, and it always fails epubcheck.
Here is one of the typical ways that I've tried to do it, but it always gives me the same errors.
Code:
$ rm ./test-epub-3-0-1.epub
$ zip -X0 ./test-epub-3-0-1.epub mimetype
adding: mimetype (stored 0%)
$ zip -rDX9 ./test-epub-3-0-1.epub META-INF -x mimetype
adding: META-INF/container.xml (deflated 30%)
$ zip -rDX9 ./test-epub-3-0-1.epub OEBPS -x mimetype
adding: OEBPS/cover.xhtml (deflated 29%)
adding: OEBPS/title_pages.xhtml (deflated 30%)
adding: OEBPS/chapter01.xhtml (deflated 30%)
adding: OEBPS/epub.css (stored 0%)
adding: OEBPS/toc.xhtml (deflated 32%)
adding: OEBPS/chapter03.xhtml (deflated 30%)
adding: OEBPS/notes.xhtml (deflated 30%)
adding: OEBPS/MyBook.opf (deflated 67%)
adding: OEBPS/chapter02.xhtml (deflated 33%)
$ cd ..
$ java -jar epubcheck-3.0.1/epubcheck-3.0.1.jar test-epub-3-0-1.epub
Epubcheck Version 3.0.1
ERROR: test-epub-3-0-1.epub: Mimetype entry must not have an extra field in its ZIP header
Validating against EPUB version 3.0
ERROR: test-epub-3-0-1.epub/mimetype: Mimetype file should contain only the string "application/epub+zip".
ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(2,161): element "package" missing required attribute "unique-identifier"
ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(2,161): unique-identifier attribute in package element must be present and have a value
ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(9,13): element "metadata" incomplete; missing required element "dc:identifier"
ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(3,12): assertion failed: package dcterms:modified meta element must occur exactly once
ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf(10,12): assertion failed: Exactly one manifest item must declare the 'nav' property (number of 'nav' items: 0).
ERROR: test-epub-3-0-1.epub/XHTML/MyBook.opf: unique-identifier attribute in package element must reference an existing identifier element id
I am on Linux and don't have access to many of the utilities and I would much prefer to create my own epub files, but I am not sure there is a real way to create truly valid epub files using zip. I know that epubcheck works because it returns no errors for epub files that I have downloaded, but there does not appear to be a way to make one on the command line that validates. I know that my mimetype file is correct and at least the first two errors should not be there. I haven't looked into the other errors because it doesn't even get past the mimetype file.
Does anyone have any recommendations on how I might be able to do this so that epubcheck will validate the file?