#!/usr/bin/bash
export PATH=@MINGW_PREFIX@/bin:$PATH
UPDMAP="@MINGW_HOOK_TARGET_PREFIX@/etc/texmf/web2c/updmap.cfg"
UPDMAPLOCAL="@MINGW_HOOK_TARGET_PREFIX@/etc/texmf/web2c/updmap-local.cfg"

cp @MINGW_HOOK_TARGET_PREFIX@/share/texmf-dist/web2c/updmap-hdr.cfg $UPDMAP
cat @MINGW_HOOK_TARGET_PREFIX@/var/lib/texmf/msys2/installedpkgs/*.maps >> $UPDMAP
if [[ -f "$UPDMAPLOCAL" ]]; then
    cat "$UPDMAPLOCAL" >> $UPDMAP
fi

echo ">>> Running updmap (this might take a while)"
# Run mktexlsr since /etc/texmf/web2c/updmap.cfg can be a new file
@MINGW_PREFIX@/bin/mktexlsr
@MINGW_PREFIX@/bin/updmap-sys --quiet --nohash
