2021-04-25 11:52:59 +03:00
|
|
|
#!/bin/bash -eu
|
2021-04-25 10:16:57 +03:00
|
|
|
s=${1:-mj-msc-full.pdf}
|
|
|
|
d=$(mktemp -d)
|
2021-04-25 11:52:59 +03:00
|
|
|
f=mj-msc.pdf
|
|
|
|
l="$d/make.log"
|
2021-04-25 10:16:57 +03:00
|
|
|
echo "Extracting $s to workdir $d/"; pdfdetach -saveall -o "$d" "$s"
|
|
|
|
echo "Logs in $l ..."; make -j "$(nproc)" -C "$d" "$f" &> "$l" || {
|
2021-04-25 11:52:59 +03:00
|
|
|
echo "Failed to generate. $l extract:"; tail -20 "$l"; 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"
|