#!/bin/sh

case $1 in
autostart)
        exec $0 start
        ;;
start)
	# if / is tmpfs, we have an old or broken jffs2
	# erase data partition and set flag between bootloader and kernel 
	{ mount|grep "on / type tmpfs" 1>&-; } && {
		mtd erase data
		jffs2root --clean
		/bin/sync && /bin/busybox reboot -f
	}
        ;;
stop)
	echo "no stop function implemented..."
        ;;
*)
        echo "Usage: $0 {start | stop }"
        exit 1
        ;;
esac
exit $?
