set boot_wait to on in the earliest possible moment. this makes webupgrade safer...
[openwrt/svn-archive/archive.git] / openwrt / target / default / target_skeleton / etc / preinit
1 #!/bin/sh
2 [ "$(/usr/sbin/nvram get boot_wait)" != "on" ] && {
3 /usr/sbin/nvram set boot_wait=on
4 /usr/sbin/nvram commit
5 }
6 mount none /proc -t proc
7 insmod diag
8 echo 0x01 > /proc/sys/diag
9 sleep 1
10 if [ $(cat /proc/sys/reset) = 1 ] || [ "$(/usr/sbin/nvram get failsafe)" = 1 ]; then
11 export FAILSAFE=true
12 while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done &
13 fi
14 /sbin/mount_root ${FAILSAFE:+failsafe}
15
16 exec /sbin/init