tag rc6
[openwrt/svn-archive/openwrt.git] / package / base-files / default / sbin / hotplug.failsafe
diff --git a/package/base-files/default/sbin/hotplug.failsafe b/package/base-files/default/sbin/hotplug.failsafe
new file mode 100755 (executable)
index 0000000..8a3cb9b
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+[ "$1" = "button" -a "$ACTION" = "pressed" ] && {
+       echo /bin/true > /proc/sys/kernel/hotplug
+       lock /tmp/.failsafe
+
+       case "$(nvram get boardtype)" in
+               0x0467|0x042f) echo "0 1 2 3 5u*";;
+                           *) echo "1 2 3 4 5u*";;
+       esac > /proc/switch/eth0/vlan/0/ports
+
+       . /etc/functions.sh
+       set_state failsafe
+       [ "$(nvram get boot_wait)" != "on" ] && {
+               nvram set boot_wait=on
+               nvram commit
+       }
+
+       netmsg 192.168.1.255 "Entering Failsafe!"
+       telnetd -l /bin/login <> /dev/null 2>&1
+
+       exec </dev/console >/dev/console 2>/dev/console
+       ash --login
+       lock -u /tmp/.failsafe
+}