#!/bin/sh

if [ -n "${PACKAGE_BUILDING}" ]; then
	exit 0
fi

if [ "$2" != "POST-DEINSTALL" ]; then
	exit 0
fi

USER=avenger
GROUP=avenger
AVDIR=/var/spool/avenger
AVETC=/etc/avenger

PW=/usr/sbin/pw

if ${PW} groupshow "${GROUP}" >/dev/null 2>&1; then
	echo
	echo "If you're done with Mail Avenger permanently, delete the $GROUP group manually: pw groupdel ${GROUP}" | fmt
fi

if ${PW} usershow "${USER}" >/dev/null 2>&1; then
	echo
	echo "If you're done with Mail Avenger permanently, delete the $USER user manually: pw userdel ${USER}" | fmt
fi

for dir in "$AVETC" "$AVDIR"; do
    if [ -d "$dir" ] && ! rmdir $dir 2>/dev/null; then
	echo
	echo "You may wish to investigate the contents of $dir and delete the directory if you're done with Mail Avenger permanently." | fmt
    fi
    echo
done


syntax highlighted by Code2HTML, v. 0.9.1