2 # Copyright (C) 2006 OpenWrt.org
3 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
7 ifconfig $ifname 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 up
11 [ -n "$ifname" ] && grep "$ifname" /proc/net/dev >/dev/null && {
13 netmsg 192.168.1.255 "Entering Failsafe!"
14 telnetd -l /bin/login <> /dev/null 2>&1
20 mount proc /proc -t proc
21 mount sysfs /sys -t sysfs
23 size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)?mt-l:s}' /proc/meminfo)
24 mount tmpfs /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
26 if grep devfs /proc/filesystems > /dev/null; then
27 mount devfs /dev -t devfs
30 HOTPLUG=/sbin/hotplug-call
32 elif [ -x /sbin/hotplug2 ]; then
33 mount -t tmpfs tmpfs /dev -o size=512K
34 mknod /dev/console c 5 1
35 /sbin/hotplug2 --coldplug --set-rules-file /etc/hotplug2-init.rules
36 /sbin/hotplug2 --no-coldplug --persistent --set-rules-file /etc/hotplug2-init.rules &
41 elif [ -x /sbin/udevd ]; then
42 mount -n -t tmpfs -o mode=0755 udev /dev
51 mkdir -p /dev/pts /dev/shm
52 mount devpts /dev/pts -t devpts
54 # the shell really doesn't like having stdin/out closed
55 # that's why we use /dev/pty/m0 and m1 as replacement
56 # for /dev/console if there's no serial console available
57 dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && {
65 echo "Press CTRL-C for failsafe"
66 trap 'FAILSAFE=true' INT
67 trap 'FAILSAFE=true' USR1
68 [ -e /etc/preinit.arch ] && . /etc/preinit.arch
70 echo "$HOTPLUG" > /proc/sys/kernel/hotplug
71 eval ${FAILSAFE:+failsafe}
72 lock -w /tmp/.failsafe
74 if [ -z "$INITRAMFS" ]; then
76 [ -f /sysupgrade.tgz ] && {
77 echo "- config restore -"
79 mv sysupgrade.tgz /tmp
80 tar xzf /tmp/sysupgrade.tgz
81 rm -f /tmp/sysupgrade.tgz