smaller extract-and-generatm

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:48 +03:00 committed by Motiejus Jakštys
parent 020447b687
commit 1681f58765

View File

@ -1,14 +1,11 @@
#!/bin/bash #!/bin/bash -eu
set -euo pipefail
s=${1:-mj-msc-full.pdf} s=${1:-mj-msc-full.pdf}
d=$(mktemp -d) d=$(mktemp -d)
f=mj-msc.pdf
readonly f=mj-msc.pdf l="$d/make.log"
readonly l="$d/make.log"
echo "Extracting $s to workdir $d/"; pdfdetach -saveall -o "$d" "$s" echo "Extracting $s to workdir $d/"; pdfdetach -saveall -o "$d" "$s"
echo "Logs in $l ..."; make -j "$(nproc)" -C "$d" "$f" &> "$l" || { echo "Logs in $l ..."; make -j "$(nproc)" -C "$d" "$f" &> "$l" || {
echo "Failed to generate. $l extract:" && tail -20 "$l" echo "Failed to generate. $l extract:"; tail -20 "$l"; exit 1
exit 1
} }
echo "Opening $d/$f ..."; xdg-open "$d/$f" echo "Opening $d/$f ..."; xdg-open "$d/$f"
echo "$d/$f was closed. Removing $d"; rm -fr "$d" echo "$d/$f was closed. Removing $d"; rm -fr "$d"