#!/bin/sh
set -eu
utility_root=$(CDPATH= cd -- "$(dirname -- "$(readlink -f -- "$0")")/.." && pwd)
. "$utility_root/runtime.env"
state="${INKLINE_TEXLIVE_STATE_DIR:-/home/root/.local/share/inkline-utilities/texlive/state}/prefix"
test -r "$state" || { echo 'Run texlive-install to download the TeX Live collection first.' >&2; exit 1; }
texlive_prefix=$(cat "$state")
export PATH="$texlive_prefix/bin/armhf-linux:$PATH"
export TEXLIVE_DOWNLOADER=curl
test -x "$texlive_prefix/bin/armhf-linux/lualatex" || { echo 'Install this optional tool with: tlmgr install lualatex' >&2; exit 1; }
utility_exec "$texlive_prefix/bin/armhf-linux/lualatex" "$@"
