#!/bin/sh

if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
    CONF="movim"
    COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)

    if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
    . /usr/share/apache2/apache2-maintscript-helper
    apache2_invoke disconf $CONF || exit $?
    elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
        [ ! -L /etc/apache2/conf.d/$CONF.conf ] || rm /etc/apache2/conf.d/$CONF.conf
    fi

    if [ "$1" = purge ]; then
        rm -rf /var/cache/movim /etc/movim /usr/share/movim /var/log/movim
	db_purge
    fi
fi

if [ -f /usr/share/debconf/confmodule ]; then
    . /usr/share/debconf/confmodule
fi
if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
    . /usr/share/dbconfig-common/dpkg/postrm
    dbc_go movim $@
fi

