#!/bin/sh
# prerm   script for thruk
#
# see: dh_installdeb(1)

set -e

case "$1" in
  remove|deconfigure)
    thruk -a uninstallcron --local || echo "ERROR: removing cron failed, please remove www-data cron manually"
    invoke-rc.d thruk stop || true
    rm -rf /usr/share/thruk/root/thruk/plugins /etc/apache2/conf-enabled/thruk.conf /etc/apache2/conf-enabled/thruk_cookie_auth_vhost.conf
    sed -i -e '/thruk_cookie_auth.include/d' /etc/apache2/sites-available/default* 2>/dev/null || true
  ;;

  upgrade|failed-upgrade)
  ;;

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

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

#DEBHELPER#

exit 0
