A third sibling toolkit: rewrite steps, justification rails, cancel/substitute highlights, and lint-on-warning builds.
28 lines
1.0 KiB
Bash
Executable File
28 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Exit 0 full, 1 degraded, 2 no LaTeX.
|
|
set -uo pipefail
|
|
QUIET=0
|
|
[[ "${1:-}" == "--quiet" ]] && QUIET=1
|
|
say() { [[ $QUIET -eq 1 ]] || echo -e "$*"; }
|
|
ok=0; warn=0; fail=0
|
|
check() {
|
|
local name="$1"; shift
|
|
if "$@" >/dev/null 2>&1; then say " ok $name"; return 0
|
|
else say " MISS $name"; return 1; fi
|
|
}
|
|
say "superderive preflight"
|
|
say "--- required ---"
|
|
check "xelatex" command -v xelatex || fail=$((fail+1))
|
|
check "standalone.cls" kpsewhich standalone.cls || fail=$((fail+1))
|
|
check "tikz.sty" kpsewhich tikz.sty || fail=$((fail+1))
|
|
check "etoolbox.sty" kpsewhich etoolbox.sty || fail=$((fail+1))
|
|
say "--- chinese figures ---"
|
|
check "ctex.sty" kpsewhich ctex.sty || warn=$((warn+1))
|
|
check "fandol" kpsewhich FandolSong-Regular.otf || warn=$((warn+1))
|
|
say "--- export ---"
|
|
check "pdftocairo" command -v pdftocairo || warn=$((warn+1))
|
|
if [[ $fail -gt 0 ]]; then say "RESULT: no LaTeX."; exit 2; fi
|
|
if [[ $warn -gt 0 ]]; then say "RESULT: degraded."; exit 1; fi
|
|
say "RESULT: full path."
|
|
exit 0
|