#! /bin/sh
set -e

NAME=apt-proxy

PREV="$2"

case "$1" in
    install|upgrade)
	if [ -n "$PREV" ] && dpkg --compare-versions "$PREV" lt "1.9.37" ; then
		# This is NOT a fresh install, a previous version of the package is either installed
		# or configured (i.e. previous package deinstalled but not purged).
		if [ -r /etc/apt-proxy/apt-proxy-v2.conf ]; then
			mv /etc/apt-proxy/apt-proxy-v2.conf /etc/apt-proxy/apt-proxy.conf
		fi
	fi

        ;;
    abort-upgrade)
        ;;
    *)
        echo "postinst called with unknown argument \`$1'" >&2
        ;;
esac

#DEBHELPER#

exit 0
