#!/bin/sh
# preinst script for lighttpd


set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
	install)
	;;

	upgrade)

	if [ "x$2" != "x" ]; then
		# We upgrade from Squeeze or older, remove alternative as spawn-fcgi is not provided anymore.
		# This should have been done since 1.4.26-1 but was accidentally forgotten
		if dpkg --compare-versions "$2" lt 1.4.28-4
		then
			update-alternatives --remove spawn-fcgi /usr/bin/spawn-fcgi.lighttpd || true
			update-alternatives --remove spawn-fcgi.1.gz /usr/share/man/man1/spawn-fcgi.lighttpd.1.gz || true
		fi

	fi
	;;

	abort-upgrade)
	;;

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

#DEBHELPER#

exit 0


