source /etc/profile.d/RkEnv.sh

if [ -f "/usr/www/entry.cgi" ]; then
	if [ ! -d "/oem/www/cgi-bin" ]; then
		mkdir -p /oem/www/cgi-bin
	fi
	if [ ! -f "/oem/www/cgi-bin/entry.cgi" ]; then
		ln -s /usr/www/entry.cgi /oem/www/cgi-bin/entry.cgi
	fi
fi

case "$1" in
	start)
		[ -f /oem/RkLunch.sh ] && source /oem/RkLunch.sh
		#recovery test
		if [ -e "/oem/rockchip_test/auto_reboot.sh" ]; then
			mkdir /data/cfg/rockchip_test
			cp /oem/rockchip_test/auto_reboot.sh /data/cfg/rockchip_test
			source /data/cfg/rockchip_test/auto_reboot.sh &
		fi
		;;
	stop)
		[ -f /oem/RkLunch-stop.sh ] && source /oem/RkLunch-stop.sh
		printf "stop finished\n"
		;;
	*)
		echo "Usage: $0 {start|stop}"
		exit 1
		;;
esac
exit 0
