#!/bin/sh

case $2 in
POST-INSTALL)
	cd /usr/local/share/fonts/TTF
	touch fonts.dir
	sed -e '/-mikachan-/d' fonts.dir > fonts.dir.tmp
	numfonts=$(echo $(cat fonts.dir.tmp /usr/local/share/mikachan/fonts.dir | wc -l) - 2 | bc)
	echo ${numfonts} > fonts.dir
	sed -e 1d fonts.dir.tmp >> fonts.dir
	sed -e 1d /usr/local/share/mikachan/fonts.dir >> fonts.dir
	rm -f fonts.dir.tmp fonts.alias.tmp
;;
DEINSTALL)
	cd /usr/local/share/fonts/TTF
	touch fonts.dir
	sed -e '/-mikachan-/d' fonts.dir > fonts.dir.tmp
	numfonts=$(echo $(cat fonts.dir.tmp | wc -l) - 2 | bc)
	echo ${numfonts} > fonts.dir
	sed -e 1d fonts.dir.tmp >> fonts.dir
;;
esac
