#!/bin/bash

(cd /etc/texmf && /usr/bin/mtxrun.lua --generate >/dev/null)

# We need to remove directory "." from luatex cache to avoid absurd behavior
for item in /var/lib/texmf/luatex-cache/context/*/trees/*.lua; do
    if grep -F '["root"]="."' "$item" >/dev/null; then
        rm -f "$item" "${item%.lua}.luc"
    fi
done
