#! /bin/sh

set -e

# Ancient versions of cubli-cups-conf added b0rken diversion
# and now we have to clean up the mess...
if test "x$1" = "xupgrade" -a -f /etc/cups/client.conf.csl-cups-orig; then
	echo "cubbli-cups-conf: Looks like we need to clean up after cubli-cups.conf 0.0.4."
	dpkg-divert --package csl-cups-conf --remove --rename --divert \
			/etc/cups/client.conf.csl-cups-orig \
			/etc/cups/client.conf
fi

if test "x$2" != "x" && dpkg --compare-versions "$2" le "0.0.7"; then
	# we have to remove old diversions manually
	echo "Cleaning up diversions from cubbli-cups-conf (<= 0.0.7)..."
	dpkg-divert --package "cubbli-cups-conf" --remove --rename \
		--divert "/etc/cups/client.conf.cubbli-cups-orig" \
		"/etc/cups/client.conf"
fi


#DEBHELPER#


exit 0
