#!/bin/sh
set -e

PREFERENCES_DIR="/var/lib/pardus/pardus-parental-control"


case "$1" in
    remove)
        # Remove smartdns service
        if systemctl list-units --type=service --all | grep -q "smartdns-rs.service"; then
            # smartdns-rs service exists
            smartdns service uninstall || true
        fi

        # Remove preferences
        if [ -d "$PREFERENCES_DIR" ] ; then
            rm -rf $PREFERENCES_DIR || true
            echo "Removed Configurations: $PREFERENCES_DIR"
        fi
        ;;

    upgrade|abort-upgrade)
        # do nothing on upgrade
        ;;

    *)
        ;;
esac

#DEBHELPER#

exit 0