2022-10-23 09:03:41 +00:00
#!/bin/bash
2022-10-23 09:10:14 +00:00
EPUB_TITLE='Epicyon User Manual'
EPUB_AUTHORS='Bob Mottram'
EPUB_LANGUAGE='English'
EPUB_TAGS='fediverse, activitypub, server, linux, python, smallweb'
EPUB_COMMENTS='ActivityPub server, designed for simplicity and accessibility. Includes calendar, news and sharing economy features to empower your federated community.'
2022-10-23 13:34:26 +00:00
EPUB_PUBLISHER='Fuzzy Books'
2022-10-23 09:10:14 +00:00
2022-10-23 09:03:41 +00:00
if [ ! -f /usr/bin/pandoc ]; then
echo 'pandoc command not found'
exit 1
fi
2022-10-23 09:52:48 +00:00
pandoc -t html -f markdown -o manual.html manual.md
git add manual.html
2022-10-23 09:03:41 +00:00
if [ -f /usr/bin/ebook-convert ]; then
2022-10-23 13:34:26 +00:00
ebook-convert manual.html manual.epub --cover manual-cover.png --authors "${EPUB_AUTHORS}" --language "${EPUB_LANGUAGE}" --tags "${EPUB_TAGS}" --comments "${EPUB_COMMENTS}" --title "${EPUB_TITLE}" --pretty-print --publisher "${EPUB_PUBLISHER}"
2022-10-23 09:03:41 +00:00
else
echo 'ebook-convert command not found'
if [ -f /usr/bin/flatpak ]; then
if ! flatpak --command="sh" run com.calibre_ebook.calibre \
2022-10-23 13:34:26 +00:00
-c "ebook-convert manual.html manual.epub --cover manual-cover.png --authors \"${EPUB_AUTHORS}\" --language \"${EPUB_LANGUAGE}\" --tags \"${EPUB_TAGS}\" --comments \"${EPUB_COMMENTS}\" --title \"${EPUB_TITLE}\" --pretty-print --publisher \"${EPUB_PUBLISHER}\""; then
2022-10-23 09:03:41 +00:00
exit 2
fi
fi
fi
if [ -f manual.epub ]; then
git add manual.epub
fi