#!/bin/sh

set -e

#EXTRA#
#DEBHELPER#

reload_apache()
{
    if apache2ctl configtest 2>/dev/null; then
        invoke-rc.d apache2 $1 || true
    else
        echo "Your apache2 configuration is broken, so we're not restarting it for you."
    fi
}


case "$1" in
    remove)
        a2dissite kolab-syncroton > /dev/null || true
        reload_apache stop
        reload_apache start

        # Now remove the symlinks we created upon installation
        rm -f /usr/share/kolab-syncroton/config/main.inc.php
        rm -f /usr/share/kolab-syncroton/config/db.inc.php
        rm -f /usr/share/kolab-syncroton/lib/plugins/kolab_auth/config.inc.php
        rm -f /usr/share/kolab-syncroton/lib/plugins/kolab_folders/config.inc.php
        rm -f /usr/share/kolab-syncroton/lib/plugins/libkolab/config.inc.php
    ;;
esac

exit 0
