#!/bin/sh

set -e

case "$1" in
    remove)
        # Calling the init script during removal
	if [ -x "/etc/init.d/enable-nat" ] ; then
	    if [ -x "`which invoke-rc.d 2>/dev/null`" ] ; then
		invoke-rc.d enable-nat stop || exit $?
	    else
		/etc/init.d/enable-nat stop || exit $?
	    fi
	fi

        # Remove diverts before removing the package
	if [ remove = "$1" ] \
	    && [ -x /usr/sbin/debian-edu-ltsp-audiodivert ] ; then
	    debian-edu-ltsp-audiodivert remove
	fi
	if [ remove = "$1" ] && [ -e /usr/share/pam-configs/edu-krb5 ]; then
            dpkg-divert --package debian-edu-config --remove /usr/share/pam-configs/krb5
	    rm /usr/share/pam-configs/edu-krb5
	fi
	if [ remove = "$1" ] && [ -e /usr/share/pam-configs/edu-nopwdchange ]; then
	    rm /usr/share/pam-configs/edu-nopwdchange
	fi
	pam-auth-update --package --remove edu-group edu-umask
	;;
esac

#DEBHELPER#
