#!/bin/sh

set -e

# summary of how this script can be called:
#        * <postrm> `remove'
#        * <postrm> `purge'
#        * <old-postrm> `upgrade' <new-version>
#        * <new-postrm> `failed-upgrade' <old-version>
#        * <new-postrm> `abort-install'
#        * <new-postrm> `abort-install' <old-version>
#        * <new-postrm> `abort-upgrade' <old-version>
#        * <disappearer's-postrm> `disappear' <overwriter>
#          <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# Source debconf library.
if [ -f /usr/share/debconf/confmodule ]; then
    . /usr/share/debconf/confmodule
fi

if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then
    . /usr/share/dbconfig-common/dpkg/postrm.mysql
    dbc_go octopussy $@
fi

case "$1" in
    purge)
        # Purge other directories that octopussy may have stuck stuff in
        rm -Rf /var/lib/octopussy /var/cache/octopussy /var/run/octopussy || true
        rm -Rf /var/run/aat /var/spool/octopussy || true
        rm -Rf /usr/share/octopussy || true
        rm -Rf /etc/octopussy /var/log/octopussy || true
        # Purge ucf entries for db.xml
        ucf --purge /etc/octopussy/conf/db.xml || true
    ;;
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

    *)
        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
