bugfix
[openwrt-10.03/.git] / target / default / target_skeleton / etc / preinit
1 #!/bin/sh
2 mount none /proc -t proc
3 insmod diag
4 echo 0x01 > /proc/sys/diag
5 sleep 1
6 if [ $(cat /proc/sys/reset) = 1 ] ; then
7   export FAILSAFE=true
8   while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done &
9 else
10   mount | grep jffs2 >&-
11   if [ $? = 0 ] && [ $(cat /proc/mtd | wc -l) = 6 ] ; then
12     jffs2root --move && reboot 
13   else
14     mtd unlock mtd4
15     mount -t jffs2 /dev/mtdblock/4 /jffs
16     pivot_root /jffs /jffs/rom
17     mount none /dev -t devfs
18     mount none /proc -t proc
19     umount rom/proc rom/dev
20   fi
21 fi
22 mount none /tmp -t ramfs
23 exec /sbin/init