2021-03-31 15:12:42 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
dir=$(mktemp -d)
|
2021-04-01 16:13:29 +03:00
|
|
|
fname=${1:-mj-msc-all.pdf}
|
|
|
|
echo "Extracting $fname to $dir/" && pdfdetach -saveall -o "$dir" "$fname"
|
|
|
|
echo "Generating $dir/$fname ..."
|
|
|
|
make -j $(nproc) -C "$dir" "$fname" &> "$dir/make.log" || {
|
|
|
|
echo "Generation failed. Here are the last 20 log lines:"
|
|
|
|
tail -20 "$dir/make.log"
|
2021-03-31 15:12:42 +03:00
|
|
|
exit 1
|
2021-04-01 16:13:29 +03:00
|
|
|
}
|
|
|
|
echo "Opening $dir/$fname ..." && xdg-open "$dir/$fname"
|
|
|
|
echo "File has been closed. Removing $dir" && rm -fr "$dir"
|