14 lines
451 B
Bash
Executable File
14 lines
451 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
dir=$(mktemp -d)
|
|
src=${1:-mj-msc-all.pdf}
|
|
dst=${2:-mj-msc.pdf}
|
|
echo "Extracting $src to $dir/" && pdfdetach -saveall -o "$dir" "$src"
|
|
echo "Generating $dir/$dst ..."
|
|
make -j $(nproc) -C "$dir" "$dst" &> "$dir/make.log" || {
|
|
echo "Generation failed. Log extract:" && tail -20 "$dir/make.log"
|
|
exit 1
|
|
}
|
|
echo "Opening $dir/$dst ..." && xdg-open "$dir/$dst"
|
|
echo "File has been closed. Removing $dir" && rm -fr "$dir"
|