#!/bin/sh
set -e

case "$1" in
    remove)
        # Remove auth for jetty to open privileged ports via authbind.
        JETTY_USER="jetty"
        JETTY_UID="`id -u $JETTY_USER`"
        if [ -f "/etc/authbind/byuid/$JETTY_UID" ]; then
                rm -f /etc/authbind/byuid/$JETTY_UID
        fi

        # Remove the default page
        if cmp --silent /var/lib/jetty9/webapps/root/index.html /usr/share/jetty9/default-root/index.html
        then
                rm /var/lib/jetty9/webapps/root/index.html
        fi
        if cmp --silent /var/lib/jetty9/webapps/root/jetty_banner.gif /usr/share/jetty9/default-root/jetty_banner.gif
        then
                rm /var/lib/jetty9/webapps/root/jetty_banner.gif
        fi
    ;;
esac

#DEBHELPER#
