#!/bin/sh

set -e

case "$1" in
    purge)
	if which ucfq >/dev/null ; then
	    for cf in $(ucfq -w orphan-sysvinit-scripts | cut -f 1 -d ':') ; do
		for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist;  do
		    rm -f "${cf}.$ext"
		done
		rm -f "$cf"
		if which ucf >/dev/null ; then
		    ucf --purge "$cf"
		fi
		if which ucfr >/dev/null ; then
		    ucfr --purge orphan-sysvinit-scripts "$cf"
		fi
		update-rc.d "${cf#/etc/init.d/}" remove >/dev/null
	    done
	fi

	;;
esac

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

#DEBHELPER#

exit 0
