-
Notifications
You must be signed in to change notification settings - Fork 6
/
pack-epub.sh
executable file
·43 lines (26 loc) · 907 Bytes
/
pack-epub.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
root=$(pwd)
EPUB_FILENAME="EPUB3-Sliderizer"
EPUB_FOLDER="${root}/_OUTPUT/content/EPUB3/"
find "${EPUB_FOLDER}" -name ".DS_Store" -depth -exec rm {} \;
#for x in `find ./$@ -name ".DS_Store" -print`
# do
# rm -f $x
# done
java -jar "${root}/tool/epubcheck/epubcheck.jar" "${EPUB_FOLDER}" -mode exp -save 2> java.out.txt
exitValue=$?
cat java.out.txt
javaout=`cat java.out.txt`
rm java.out.txt
#echo ${javaout} ## no line breaks!
echo "[INFO] java (epubcheck): ${exitValue}"
if [ $exitValue != 0 ]
then
#[[ ${javaout} =~ "WARNING" ]] && echo "WARNING(s)"
#[[ ${javaout} =~ "ERROR" ]] && echo "ERROR(s)"
#[[ ${javaout} =~ "ERROR" ]] && exit $exitValue
[[ ${javaout} == *"ERROR"* ]] && exit $exitValue
# echo ${javaout} | grep 'ERROR' # &> /dev/null
fi
mv "${root}/_OUTPUT/content/EPUB3.epub" "${root}/_OUTPUT/content/${EPUB_FILENAME}.epub"
#open "${root}/_OUTPUT/content/"