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