#!/bin/bash -e

# This is the default postinst file from the cdd-dev package which is used
# in all meta packages.  If there is a certain need to provide extra
# postinst 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#

# 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-deconfigure|abort-remove|abort-upgrade)
	;;
    configure|upgrade)
	db_get "shared/#CDD#-common/usermenus" || true
	case "$RET" in
    	    "Each package installation")
        	/usr/sbin/cdd-update-usermenus #CDD#
                ;;
            "End of installation")
                touch /var/run/#CDD#-common.usermenu
                ;;
        esac
	;;
    *)
	echo "postinst called with unknown argument \`$1'" >&2
	exit 1
	;;
esac

db_stop

#DEBHELPER#

exit 0
