#!/proc/boot/esh
# Last modified : 2006/03/22

#	print
#	print Now installing ND300 ...
#	print

	slay -f sysmng >/dev/null 2>/dev/null
	slay -f apl >/dev/null 2>/dev/null
	slay -f rcore >/dev/null 2>/dev/null
	slay -f net >/dev/null 2>/dev/null
	slay -f cv >/dev/null 2>/dev/null
	slay -f hbt >/dev/null 2>/dev/null
	slay -f prtfwd >/dev/null 2>/dev/null
	slay -f tp >/dev/null 2>/dev/null

#	slay -f slinger >/dev/null 2>/dev/null
#	slay -f ftpd >/dev/null 2>/dev/null
#	slay -f inetd >/dev/null 2>/dev/null
#	slay -f io-net >/dev/null 2>/dev/null
	
	sleep 3
	sync


	### extract archieves
#	cd /
#	tar zxf ND300.tgz
#	sync

	cd /data
	tar zxf /user/ND300/system/HTML.tgz
	sync


	### change owner
	cd /
	find . -type f -chown root:root >/dev/null 2>/dev/null
	find . -type d -chown root:root >/dev/null 2>/dev/null
	sync

	### change attribute
	cd /
	chmod 755 * >/dev/null 2>/dev/null
	sync

	cd /bin
	find . -type f -chmod 755 >/dev/null 2>/dev/null
	find . -type d -chmod 755 >/dev/null 2>/dev/null
	sync

	cd /lib
	find . -type f -chmod 755 >/dev/null 2>/dev/null
	find . -type d -chmod 755 >/dev/null 2>/dev/null
	sync

	cd /user
	find . -type f -chmod 755 >/dev/null 2>/dev/null
	find . -type d -chmod 755 >/dev/null 2>/dev/null
	sync

	cd /data
	find . -type f -chmod 755 >/dev/null 2>/dev/null
	find . -type d -chmod 755 >/dev/null 2>/dev/null
	chmod 777 HTML_FILES >/dev/null 2>/dev/null
	chmod 777 USER_DATA >/dev/null 2>/dev/null
	sync

	cd /data/HTML_FILES
	find . -type f -chmod 666
	sync

	cd /data/USER_DATA
	find . -type f -chmod 666
	sync

	cd /data/etc
	find . -type f -chmod 600
	sync

	cd /
	cp /bin/bootscript-st /bin/bootscript
	sync

	sync
	buzzer 300

	### for emergency use
	esh /bin/install_sub >/dev/null 2>/dev/null

#	print
#	print Install Finished ...
#	print
	
#	sleep 1
#	print Rebooting ...
#	sync
#	sync
#	cv reset
