2 # Copyright (C) 2006 OpenWrt.org
3 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
6 mknod /dev/console c 204 64
7 exec </dev/console > /dev/console 2>&0
10 ifconfig $ifname 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 up
14 [ -n "$ifname" ] && grep "$ifname" /proc/net/dev >/dev/null && {
16 netmsg 192.168.1.255 "Entering Failsafe!"
17 telnetd -l /bin/login <> /dev/null 2>&1
23 mount none /proc -t proc
24 mount none /sys -t sysfs
26 size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)?mt-l:s}' /proc/meminfo)
27 mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
29 if grep devfs /proc/filesystems > /dev/null; then
30 mount none /dev -t devfs
33 HOTPLUG=/sbin/hotplug-call
35 mount -t tmpfs tmpfs /dev -o size=512K
36 # mknod /dev/console c 5 1
38 /sbin/hotplug2 --coldplug --set-rules-file /etc/hotplug2-init.rules
39 /sbin/hotplug2 --no-coldplug --persistent --set-rules-file /etc/hotplug2-init.rules &
45 mkdir -p /dev/pts /dev/shm
46 mount none /dev/pts -t devpts
48 # the shell really doesn't like having stdin/out closed
49 # that's why we use /dev/pty/m0 and m1 as replacement
50 # for /dev/console if there's no serial console available
51 dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && {
59 trap 'FAILSAFE=true' USR1
60 [ -e /etc/preinit.arch ] && . /etc/preinit.arch
62 echo "$HOTPLUG" > /proc/sys/kernel/hotplug
63 eval ${FAILSAFE:+failsafe}
64 lock -w /tmp/.failsafe
66 [ -f /sysupgrade.tgz ] && {
67 echo "- config restore -"
69 mv sysupgrade.tgz /tmp
70 tar xzf /tmp/sysupgrade.tgz
71 rm -f /tmp/sysupgrade.tgz