#!/bin/sh
#
# postrm script for the Debian GNU/Linux lilypond package
#   by Anthony Fok <foka@debian.org>
#   This is free software; see the GNU General Public Licence
#   version 2 or later for copying conditions.  There is NO warranty.
#   Last modified:  Fri, 14 Aug 1998 00:07:07 -0600

set -e

package=lilypond
font_supplier=public
font_typeface=lilypond
std_TEXMFMAIN=/usr/lib/texmf
std_VARTEXFONTS=/var/spool/texmf

#DEBHELPER#

TEXMFMAIN=`/usr/bin/kpsewhich -expand-var '$TEXMFMAIN'`
: ${TEXMFMAIN:=$std_TEXMFMAIN}
VARTEXFONTS=`/usr/bin/kpsewhich -expand-var '$VARTEXFONTS'`
: ${VARTEXFONTS=$std_VARTEXFONTS}

case "$1" in
    upgrade)
	# Clear out the old TFM and PK files in case the fonts were modified
	rm -rf $VARTEXFONTS/tfm/$font_supplier/$font_typeface
	rm -rf $VARTEXFONTS/pk/*/$font_supplier/$font_typeface
    ;;

    remove|purge)
	# Clear out the old TFM and PK files in case the fonts were modified
	rm -rf $VARTEXFONTS/tfm/$font_supplier/$font_typeface
	rm -rf $VARTEXFONTS/pk/*/$font_supplier/$font_typeface
	/usr/bin/mktexlsr
    ;;

    failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

    *)
	echo "postrm called with unknown argument \`$1'" >&2
	exit 0
    ;;
esac
