#!/bin/sh

if [ "x$2" = "xPOST-DEINSTALL" ]; then
	cd ${PKG_PREFIX}/lib/X11/fonts/local;  ${PKG_PREFIX}/bin/mkfontdir
	cd ${PKG_PREFIX}/lib/X11/fonts/Type1; /usr/local/bin/type1inst -nogs -nolog -quiet
	${PKG_PREFIX}/bin/xset fp rehash ||
	(
	 echo "**********************************************************"
	 echo "You should restart X server or do 'xset fp rehash' command"
	 echo "to enable this update."
	 echo "**********************************************************"
	)
	[ `wc -c ${PKG_PREFIX}/lib/X11/fonts/local/fonts.dir | awk '{print $1}'` = 2 ] && rm -f ${PKG_PREFIX}/lib/X11/fonts/local/fonts.dir
	[ `wc -c ${PKG_PREFIX}/lib/X11/fonts/Type1/fonts.dir | awk '{print $1}'` = 2 ] && rm -f ${PKG_PREFIX}/lib/X11/fonts/Type1/fonts.dir
	[ `wc -c ${PKG_PREFIX}/lib/X11/fonts/Type1/fonts.scale | awk '{print $1}'` = 2 ] && rm -f ${PKG_PREFIX}/lib/X11/fonts/Type1/fonts.scale
# Remove a backup file made by type1inst
	rm -f ${PKG_PREFIX}/lib/X11/fonts/Type1/fonts.scale.bak
	rmdir ${PKG_PREFIX}/lib/X11/fonts/Type1 2>/dev/null || true
fi
