#!/bin/sh

if [ -f /.fallback-reboot-passwd ]
then
	:
else
	touch /.fallback-reboot-passwd
	chmod 400 /.fallback-reboot-passwd
	chown root /.fallback-reboot-passwd
	PATH=$PATH:/usr/bin:/dcs/bin:/usr/local/bin
	export PATH
	FN="/.fallback-reboot-passwd"
	/usr/local/sbin/gen-pas > "$FN"
	if [ -f "$FN" ]
	then
		if [ -s "$FN" ]
		then
			:
		else
			# if the file exists but has a 0 length, then remove it so we
			# don't start up with the null string as a password!
			rm "$FN"
			exit 1
		fi
	fi
fi

/usr/local/sbin/fallback-reboot &