#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
#
# postinst of the MCDE package: what a package manager cannot do for the
# desktop.  $1 is configure (install or upgrade), abort-*, or triggered.
#
# The font index.  MCDE installs its own fonts below /usr/mdt/fonts and a
# fonts.dir for the directory it knows; a font in a subdirectory is invisible
# to the X server without an index of its own.  Debian's xfonts-utils brings
# mkfontdir, which is in the dependency list of the package for this reason.
# A host without it is not an error: the fonts of the session are also in the
# X server's own path.

set -e

case ${1:-} in
configure) ;;
*) exit 0 ;;
esac

PREFIX=/usr/mdt

if command -v mkfontdir >/dev/null 2>&1; then
	find "$PREFIX/fonts" -type d 2>/dev/null | while IFS= read -r d; do
		case $d in */hack) continue ;; esac
		mkfontdir "$d" >/dev/null 2>&1 || true
	done
fi

exit 0
