Check dependencies in Ebook gen script (#406)

pull/440/head
Sainadh Devireddy 2020-07-04 06:54:24 +05:30 committed by GitHub
parent d57b3d1f95
commit 60202315cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,4 @@
#! /usr/bin/env sh #! /usr/bin/env bash
generate_from_stdin() { generate_from_stdin() {
outfile=$1 outfile=$1
@ -34,6 +34,20 @@ generate () {
cat $name.md | generate_from_stdin $name.epub $language cat $name.md | generate_from_stdin $name.epub $language
} }
# Check if depencies exist
check_dependencies () {
for dependency in "${dependencies[@]}"
do
if ! [ -x "$(command -v $dependency)" ]; then
echo "Error: $dependency is not installed." >&2
exit 1
fi
done
}
dependencies=("pandoc")
check_dependencies
generate_with_solutions generate_with_solutions
generate README-ja ja generate README-ja ja
generate README-zh-Hans zh-Hans generate README-zh-Hans zh-Hans