wip report-and-generate

This commit is contained in:
Motiejus Jakštys
2021-03-31 15:12:42 +03:00
parent 1344683602
commit ee34e97799
3 changed files with 34 additions and 111 deletions

28
IV/extract-and-generate Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -euo pipefail
fail() {
>&2 echo "$1"
exit 1
}
dir=$(mktemp -d)
echo "Extracting all files from the report ..."
pdfdetach -saveall -o "$dir" mj-msc-all.pdf
echo "Re-generating the report..."
fail=0
make -C "$dir" -j $(nproc) mj-msc-all.pdf 2>&1 > make.log || fail=1
if [[ $fail == 1 ]]; then
>&2 echo "Generation failed. Here are the last 10 log lines:"
tail -10 "$dir/make.log"
exit 1
fi
open=open
if [[ $(uname) == Linux ]]
open=xdg-open
fi
"$open" "$dir/mj-msc-all.pdf"