#! /bin/sh
cat horrors2.xhtml > epub/book.xhtml
rm -rf epub/art
mkdir epub/art
cp art/*.png art/*.jpg epub/art
cp style.css epub/
cd epub
echo -n application/epub+zip > mimetype
cat >MANIFEST < content.opf <
Horrors 2
en
Horrors2
The Something Awful Forums
EOF
find . -type f | sed 's#./##' | while read fn; do
b=$(basename $fn)
id=thing$count
count=$(expr $count + 1)
case "$b" in
META-INF/*|MANIFEST|mimetype|content.opf)
continue
;;
book.xhtml)
id=book
type=application/xhtml+xml
;;
*.css)
type=image/css
;;
book.ncx)
id=ncx
;;
*.png)
type=image/png
;;
*.jpg)
type=image/jpeg
;;
*.svg)
type=image/svg+xml
;;
*.otf)
type=application/octet-stream
;;
esac
echo "- " >> content.opf
echo $fn >> MANIFEST
done
cat >> content.opf <
EOF
xargs zip -Xr9D ../book.epub < MANIFEST