#!/bin/sh

EXTIF=$(</etc/EXTIF)
EXTIP=`ifconfig $EXTIF | awk '/inet/ {sub(/.*:/,"",$2);print $2}'`
DESTIP=$(</etc/forwarding/DESTIP)
OLDEXTIP=$(</etc/OLDEXTIP)
IFCHANGE=0

if [ "$OLDEXTIP" != "$EXTIP" ]; then
	/etc/init.d/ipchange
	IFCHANGE=1
	echo "Interface IP has changed and has not yet been updated by cron."
	echo "A manual update has been forced.  Re-run the command."
fi

