#!/bin/bash -e

if [ "$1" = "install" -o "$1" = "upgrade" ]; then
    case $2 in
    3.[123]*)    # version 3.1.0 - 3.3.5
	echo "The rules files located in /etc/ipmasq/rules have been placed under"
	echo "package manager control as of version 3.4.0.  It is safe (and"
	echo "recommended) to allow dpkg to replace your version."
	echo
	echo -n "Press ENTER to continue."
	read dummy
	;;
    esac

    case $2 in
    3.[123]*|3.4.[0123])	#version 3.1.0 - 3.4.3
        echo "The rules files I50external.def and O50external.def have changed"
	echo "position to I90external.def and O90external.def, respectively."
	echo "May I move these rules files (and their corresponding .rul files)"
	echo -n "to their new positions? [Y/n] "
	read externalmove
	case $externalmove in
	    [Nn]*)	;;
	    *)		RULES=/etc/ipmasq/rules
	    		mv $RULES/I50external.def $RULES/I90external.def 2>/dev/null
			mv $RULES/I50external.rul $RULES/I90external.rul 2>/dev/null || true
	    		mv $RULES/O50external.def $RULES/O90external.def 2>/dev/null
			mv $RULES/O50external.rul $RULES/O90external.rul 2>/dev/null || true
			;;
	esac
    esac
fi

#DEBHELPER#

