#!/bin/sh
set -e
set -u

CRUFT_ROOT="${CRUFT_ROOT:-""}"

test -d "$CRUFT_ROOT/usr/share/fontconfig/conf.avail" || exit 0

find "$CRUFT_ROOT/usr/share/fontconfig/conf.avail/" -maxdepth 1 -type f -printf "%f\n" | while read -r file
do
    if test -e "$CRUFT_ROOT/etc/fonts/conf.d/$file"
    then
        echo "/etc/fonts/conf.d/$file"
    fi
done

find "$CRUFT_ROOT/usr/share/fonts" -name .uuid | sed "s#^$CRUFT_ROOT##"

test -d "$CRUFT_ROOT/usr/local/share/fonts/" && find "$CRUFT_ROOT/usr/local/share/fonts" -name .uuid | sed "s#^$CRUFT_ROOT##"

exit 0
