# Create symlinks in /usr/bin/, for e.g. pdflatex and lualatex.
# Is not inside BUILD, to prevent /usr/bin/lualatex dual-ownership.
texlinks -q

# Fixes "can't find foo.{tex,sty}" errors
mktexlsr --quiet

# From http://tug.org/pipermail/tlbuild/2010q2/001606.html
# Comments out comicvn.map and mscorevn.map from /usr/share/texmf-config/web2c/updmap.cfg
updmap-sys --quiet --syncwithtrees

# Hint from https://bbs.archlinux.org/viewtopic.php?pid=607603
# Prevent error message:  Fatal format file error; I'm stymied
# fmtutil-sys needs /usr/bin/luatex from luatex module (since 10-Jan-2011).
if [ ! -x /usr/bin/luatex ] || [ ! -x /usr/bin/lualatex ] ; then
  # /usr/bin/luatex changed ownership from texlive to luatex module.
  lin -c luatex
fi

# Running "--missing" first, to fix these 2 errors:
# tcfmgr: config file `tcfmgr.map' (usually in $TEXMFMAIN/texconfig) not found (ls-R missing?).
# fmtutil: config file `fmtutil.cnf' not found.
fmtutil-sys --quiet --missing
# "--all" is the important command.
fmtutil-sys --quiet --all > /dev/null
