#!/bin/sh

set -e

case "$1" in
    purge)
    
        if [ -d /opt/xplico ]; then
            rm -rf /opt/xplico
        fi
    
    ;;
    
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
        if [ -d /opt/xplico/xi/app/tmp/cache ]; then
            rm -rf /opt/xplico/xi/app/tmp/cache/models/*
            rm -rf /opt/xplico/xi/app/tmp/cache/views/*
        fi
        if [ -f /etc/apache2/sites-enabled/098-xplico.conf ]; then
            rm -f /etc/apache2/sites-enabled/098-xplico.conf
        fi
        
        apache2ctl restart
    
    ;;

    *)
        echo "postrm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

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

#DEBHELPER#

exit 0
