#!/sbin/sh
(
PATH=/bin:/usr/sbin:/usr/bin
export PATH

# When shutting down security mode is set to command if full.
# If the security mode is changed, /security-full is touched.
# When starting security mode is reset to full when /security-full
# exists and all mode is command.

file=/security-full
mode=`expr "\`eeprom security-mode\`" : 'security-mode=\(.*\)'`
#echo mode=$mode
case "$1" in
'start')
	if [ -f $file -a "$mode" = command ]
	then
	    rm $file && eeprom security-mode=full
	    #echo mode set to full
	fi

	;;

'stop')
	if [ "$mode" = full ]
	then
	    touch $file && eeprom security-mode=command
	    #echo mode set to command
	fi
	;;

*) echo Usage: /etc/init.d/security-mode { start | stop } 1>&2
;;
esac
)
