#!/bin/sh

# Load ipmodule variables
. /opt/gira/share/devicestack/ipmodule-vars

case "$1" in
	start)
		echo -n "Restoring U-Boot environment ... "
		if [ -f /etc/fw_env.default ]
		then
			if [ "$(/usr/sbin/fw_printenv | sed  -e '/^[^= ]\+=/ s/=/ /')" != "$(cat /etc/fw_env.default)" ]
			then
				/usr/sbin/fw_setenv -s /etc/fw_env.default
				echo "done."
			else
				echo "skipping. Already up-to-date."
			fi
		else
			echo "skipping. No /etc/fw_env.default found."
		fi
		;;
	stop)
		;;
	*)
		echo "Usage: $0 (start|stop)"
		exit 1
esac

exit 0

