#!/bin/sh

set -e

VERSION=%VERSION%

case $1 in
    purge)
	# Remove the "/etc/orthanc" directory
        if test -d "/etc/orthanc"; then
            rmdir --ignore-fail-on-non-empty "/etc/orthanc" || true
        fi

        # Remove the "orthanc" group and user
        if getent passwd orthanc >/dev/null; then
                if [ -x "$(command -v deluser)" ]; then
                        deluser --system orthanc
                fi
        fi
        if getent group orthanc >/dev/null; then
                if [ -x "$(command -v delgroup)" ]; then
                        delgroup --system orthanc
                fi
        fi
	;;

    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
	;;

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

#DEBHELPER#
