security-engineering-ebook/generate.sh

38 lines
830 B
Bash
Raw Normal View History

2020-01-31 21:20:30 +00:00
#!/bin/bash
2020-07-11 07:51:00 +00:00
COVER_URL=https://www.cl.cam.ac.uk/~rja14/Papers/SEv3-cover.pdf
2020-02-01 14:59:29 +00:00
FINAL_PDF=security-engineering-3rd-edition.pdf
2020-02-01 15:08:35 +00:00
INPUT_FILE="urls.txt"
function assert_installed() {
for var in "$@"; do
if ! which $var &> /dev/null; then
echo "Install $var!"
exit 1
fi
done
}
2021-05-28 20:42:31 +00:00
assert_installed wget
2020-02-01 14:59:29 +00:00
if [[ $@ == *'--download-cover-image'* ]]; then
echo "Downloading cover image"
assert_installed convert
wget --timeout=10 --timestamping "$COVER_URL" --output-document cover.pdf
2020-07-11 07:51:00 +00:00
echo "Cover Image downloaded"
2020-02-01 14:59:29 +00:00
fi
2020-01-31 21:20:30 +00:00
2020-02-01 15:08:35 +00:00
declare -a FILES_LIST
while IFS= read -r line
do
FILENAME=$(basename "$line")
FILES_LIST+=("$FILENAME")
done < "$INPUT_FILE"
2020-02-01 14:59:29 +00:00
echo "Starting PDF download"
wget --timeout=10 --timestamping --input-file "urls.txt"
2020-02-01 14:59:29 +00:00
echo "All PDFs downloaded"
2020-01-31 21:20:30 +00:00
2021-05-28 20:42:31 +00:00
pystitcher book.md