#!/bin/sh
# postrm script for geoip-database-contrib

set -e

case "$1" in
    purge)
        rm -f /etc/cron.d/geoip-database-contrib
        if which ucf > /dev/null
        then
            ucf --purge /etc/cron.d/geoip-database-contrib
        fi

        if [ -f /usr/share/debconf/confmodule ]; then
            . /usr/share/debconf/confmodule
            db_purge
        fi

		rmdir /usr/share/GeoIP || true
		rmdir /etc/cron.d || true
    ;;

    remove)
        if [ -x /usr/bin/killall ]; then
            killall -9 -q geoip-database-contrib_update || true
        fi

        rm -f /usr/share/GeoIP/GeoIP.dat.gz
        rm -f /usr/share/GeoIP/GeoIPv6.dat.gz
        rm -f /usr/share/GeoIP/GeoLiteCity.dat.gz
        rm -f /usr/share/GeoIP/GeoIPASNum.dat.gz
        rm -f /usr/share/GeoIP/GeoIP.dat
        rm -f /usr/share/GeoIP/GeoIPv6.dat
        rm -f /usr/share/GeoIP/GeoLiteCity.dat
        rm -f /usr/share/GeoIP/GeoIPASNum.dat
		rm -f /usr/share/GeoIP/GeoIPASNumv6.dat
		rm -f /usr/share/GeoIP/GeoLiteCityv6.dat
    ;;
esac

#DEBHELPER#

exit 0
