#!/bin/sh

### BEGIN INIT INFO
# Provides:        pvenetcommit
# Required-Start:  checkroot
# Required-Stop:
# Default-Start:   S
# Default-Stop:
# Short-Description: commits network changes
### END INIT INFO

set -e

. /lib/lsb/init-functions

PATH=/sbin:/bin

IFFN=/etc/network/interfaces

# we cant use perl here, because this skript runs before
# we have /usr mounted

case "$1" in
    start)
	if test -f "${IFFN}.new"; then
	    echo "committing new network configuration";
	    if ! mv "${IFFN}.new" $IFFN; then
		echo "unable to commit changes to '${IFFN}' - $!\n";
	    fi
	fi
	;;
    stop|restart|force-reload)
	exit 0
	;;
    *)
	echo "Usage: /etc/init.d/pvenetcommit {start}"
	exit 0
	;;
esac

exit 0