#!/bin/sh

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

case "$1" in
	start)
		printf "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
				printf "done.\\n"
			else
				printf "skipping. Already up-to-date.\\n"
			fi
		else
			printf "skipping. No /etc/fw_env.default found.\\n"
		fi
		;;
	stop)
		;;
	*)
		printf "Usage: %s (start|stop)\\n" "$0"
		exit 1
esac

exit 0

