#!/bin/bash -e

# This is the default postrm file from the cdd-dev package which is used
# in all meta packages.  If there is a certain need to provide extra
# postrm files for some meta packages this template will be appended.  Thus
# it will be checked whether debconf was just initialized.
#
# You should not insert the _DEBHELPER_ template in the special postscript
# file because it is in the end of this template anyway.

test -x /usr/sbin/cdd-update-menus && /usr/sbin/cdd-update-menus -d #CDD# 

test -s /etc/cdd/cdd.conf         && . /etc/cdd/cdd.conf
test -s /etc/cdd/#CDD#/#CDD#.conf && . /etc/cdd/#CDD#/#CDD#.conf

if [ -x /usr/sbin/cdd-update-usermenus ] ; then
    # Initialize debconf if not yet done
    if [ _"$DEBCONF_REDIR" = _"" ]; then
        . /usr/share/debconf/confmodule
        db_version 2.0
    fi

    . /etc/cdd/cdd.conf
    if [ -s /etc/cdd/#CDD#/#CDD#.conf ] ; then . /etc/cdd/#CDD#/#CDD#.conf ; fi

    case "$1" in
	abort-install|abort-upgrade|failed-upgrade|upgrade)
	    ;;
	remove|purge)
	    db_get "shared/#CDD#-config/usermenus" || true
	    case "$RET" in
		"Each package installation")
		    /usr/sbin/cdd-update-usermenus #CDD#
		    ;;
		"End of installation")
		    touch /var/run/#CDD#-config.usermenu
		    ;;
	    esac
	    ;;
	*)
	    echo "postrm called with unknown argument \`$1'" >&2
	    exit 1
	    ;;
    esac
fi


#DEBHELPER#
