#!/bin/sh
set -e

#DEBHELPER#

unset_perms() {
    dpkg-statoverride --remove "$1" >/dev/null 2>/dev/null || true
}

if test "$1" = "purge"; then
    spool=/var/lib/nsd3
    rm -f $spool/nsd.db $spool/ixfr.db $spool/xfrd.state
    rmdir $spool 2>/dev/null || true

    unset_perms /var/lib/nsd3
    unset_perms /etc/nsd3/nsd.conf
    unset_perms /etc/nsd3

    deluser --quiet nsd > /dev/null || true
fi

exit 0
