#! /bin/sh
# postrm script for zope-common

set -e

zopeuser=zope
zopegroup=$zopeuser

case "$1" in
    purge)
	# remove zope user and group.
    #    if getent passwd $zopeuser > /dev/null 2>&1 ; then
    #        userdel $zopeuser
    #    fi
    #    if getent group $zopegroup > /dev/null 2>&1 ; then
    #        groupdel $zopegroup
    #    fi

	# remove instance stuff (commented out)
        #if [ ! -f /var/lib/zope/moved ] ; then
        #    rm -f /var/lib/zope/var/Data.fs.*
        #    rm -f /var/lib/zope/access
        #    # PCGI resuource file should have already been removed.
        #fi

        rm -rf /var/lib/zope/dzhandle

        LOCALDIR=/usr/local/share/zope
        rmdir --ignore-fail-on-non-empty $LOCALDIR/Extensions || true
        rmdir --ignore-fail-on-non-empty $LOCALDIR/Products || true
        rmdir --ignore-fail-on-non-empty $LOCALDIR || true
        ;;

    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#

exit 0
