Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ if [ $# -gt 2 ]; then
echo "Warning: extra arguments are ignored"
fi

if [ ! -d $src_dir ]; then
if [ ! -d "$src_dir" ]; then
echo "Error: directory '$src_dir' does not exist"
exit
fi

if [ ! -d $dst_dir ]; then
if [ ! -d "$dst_dir" ]; then
echo "Error: directory '$dst_dir' does not exist"
exit
fi

set -e
pwd=$PWD
cd $src_dir
zip -X0 $dst_dir/$name.zip mimetype
zip -Xr --symlinks $dst_dir/$name.zip META-INF EPUB
mv $dst_dir/$name.zip $dst_dir/$name.epub
cd $pwd
cd "$src_dir"
zip -X0 "$dst_dir/$name.zip" mimetype
zip -Xr --symlinks "$dst_dir/$name.zip" META-INF EPUB
mv "$dst_dir/$name.zip" "$dst_dir/$name.epub"
cd "$pwd"

for dir in ./*/; do
if [[ $dir =~ epubcheck-[0-9.]+ ]]; then
Expand All @@ -40,8 +41,8 @@ for dir in ./*/; do
fi
done

if [ -f $epubcheck_dir/epubcheck.jar ]; then
java -jar $epubcheck_dir/epubcheck.jar $dst_dir/$name.epub
if [ -f "$epubcheck_dir/epubcheck.jar" ]; then
java -jar "$epubcheck_dir/epubcheck.jar" "$dst_dir/$name.epub"
else
echo "Warning: could not find epubcheck.jar"
fi
Expand Down