#!/bin/sh
set -e
sysconfdir=/etc/indimail
rm=/bin/rm
rmdir=/bin/rmdir
####################################

case "$1" in
    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

# we are doing upgrade or removal
if [ " $1" = " upgrade" ] ; then
	if [ ! "${prefix}" = "/usr" ] ; then
		echo "recreating ld.so cache"
		/sbin/ldconfig
	fi
	exit 0
fi

case "$1" in
    failed-upgrade|abort-install|abort-upgrade|disappear)
	exit 0
    ;;
esac
#
# Debian silliness
#
if [ "$1" = "remove" -o "$1" = "purge" ] ; then
	for i in QUEUE_BASE QUEUE_COUNT QUEUE_START
	do
		${rm} -f ${sysconfdir}/ezmlm/global_vars/$i
	done
	${rmdir} --ignore-fail-on-non-empty ${sysconfdir}/ezmlm/global_vars 2>/dev/null || true
fi
exit 0
