#!/bin/sh
set -e

log_debug() {
	echo "Debug: piuparts exception for package $PIUPARTS_OBJECTS"
}

# cleanup from pre_remove_exceptions
rm -fv /etc/apt/apt.conf.d/piuparts-allow-remove-essential

case ${PIUPARTS_OBJECTS%%=*} in
	asclassic)
		case "$PIUPARTS_DISTRIBUTION" in
			lenny)
				# purging works in lenny
				;;
			*)
				log_debug
				# postrm purge unconditionally removes some files that may be gone already
				sed -i 's/rm system.steprc menudefs.hook/rm -f system.steprc menudefs.hook/' /var/lib/dpkg/info/asclassic.postrm
				;;
		esac
		;;
esac
