#! /bin/sh

set -e

. /usr/share/debconf/confmodule

if [ "$1" = "purge" ]; then

    webserver="apache2"
    pkgname=loganalyzer

    if [ -x /usr/sbin/$webserver ];
    then

        HTTPD_ETC=/etc/$webserver
        HTTPD_CONF_OLD=$HTTPD_ETC/conf.d
        HTTPD_CONF_NEW=$HTTPD_ETC/conf-available
        if [ -d $HTTPD_ETC ];
        then
            if [ -d ${HTTPD_CONF_OLD} -a -h ${HTTPD_CONF_OLD}/${pkgname} ];
            then
                rm ${HTTPD_CONF_OLD}/${pkgname}
            fi
            if [ -d ${HTTPD_CONF_NEW} -a -h ${HTTPD_CONF_NEW}/${pkgname}.conf ];
            then
                if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
                    . /usr/share/apache2/apache2-maintscript-helper
                    apache2_invoke disconf loganalyzer.conf || exit $?
                fi
                rm ${HTTPD_CONF_NEW}/${pkgname}.conf
            fi
        fi


    fi
fi

#DEBHELPER#

