#!/bin/sh

set -e

#DEBHELPER#

# DJ: function to comment us out in httpd.conf
killconf () {
	if [ -f /etc/apache/httpd.conf ]; then
		tmpfile=/etc/apache/httpd.conf.tmp.$$
		cat /etc/apache/httpd.conf |\
			 sed 's/^(LoadModule.*mod_perl\.so)/#\1/' > $tmpfile
		mv -f $tmpfile /etc/apache/httpd.conf
		# Let the user restart when they want to.
		# ask_restart
	fi
}

# Restart apache if user wants.
ask_restart () {
	echo -n "An Apache module has been modified.  Restart apache [Y/n]? "
	read CONFIG || true
	if [ ".$CONFIG" != ".n" -a ".$CONFIG" != ".N" ]
	then
		test -x /usr/sbin/apachectl && /usr/sbin/apachectl restart || true
	fi
}

case "$1" in
  remove)
	killconf ;;
  upgrade | deconfigure | failed-upgrade)
	:
	;;
  *) echo "$0: didn't understand being called with \`$1'" 1>&2
     exit 1;;
esac

exit 0
