#!/bin/sh -e

MENUFILE="/etc/alternc/menulist.txt"

case "$1" in
  remove)
    # Remove Awstats references from Apache configuration
    # unconfigure /etc/alternc/templates/apache/httpd.conf
    # unconfigure /etc/alternc/templates/apache-ssl/httpd.conf
    alternc.install

    ;;
  purge)
    #/usr/lib/alternc/quota_delete aws
    if [ -e "$CONFIGFILE" -a -x "/usr/bin/mysql" ]; then
        . "$CONFIGFILE"
        mysql -f --defaults-file=/etc/alternc/my.cnf \
              -e "DROP TABLE IF EXISTS aws,aws_users,aws_access;"
    fi
    #rm -rf /var/cache/awstats
    #rm -f /etc/alternc/awstats.htpasswd
    rm -f /etc/alternc/alterncawstats.conf \
        /etc/apache-ssl/conf.d/alterncawstats.conf
    
    # FIXME : ALTERNC DEPENDS ON APACHE2, APACHE IS NO LONGER REQUIRED
    # REMOVE THE FOLLOWING LINE TO CLEAN THIS FILE

    #if [ -x /usr/sbin/apache ]; then
    #    rm -f /etc/apache/conf.d/alterncawstats.conf
    #fi
    #if [ -x /usr/sbin/apache2 ]; then
        rm -f /etc/apache2/conf.d/alterncawstats.conf
    #fi
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
