stud/IV/extract-and-generate

15 lines
420 B
Plaintext
Raw Normal View History

2021-03-31 15:12:42 +03:00
#!/bin/bash
set -euo pipefail
2021-04-25 10:16:57 +03:00
s=${1:-mj-msc-full.pdf}
d=$(mktemp -d)
2021-04-06 09:40:43 +03:00
2021-04-25 10:16:57 +03:00
readonly f=mj-msc.pdf
readonly l="$d/make.log"
echo "Extracting $s to workdir $d/"; pdfdetach -saveall -o "$d" "$s"
echo "Logs in $l ..."; make -j "$(nproc)" -C "$d" "$f" &> "$l" || {
echo "Failed to generate. $l extract:" && tail -20 "$l"
2021-03-31 15:12:42 +03:00
exit 1
2021-04-01 16:13:29 +03:00
}
2021-04-25 10:16:57 +03:00
echo "Opening $d/$f ..."; xdg-open "$d/$f"
echo "$d/$f was closed. Removing $d"; rm -fr "$d"