3 export PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
5 mount none
/proc
-t proc
6 size
=$
(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc
/meminfo
)
7 mount none
/tmp
-t tmpfs
-o size
=$size
10 echo /sbin
/hotplug.failsafe
> /proc
/sys
/kernel
/hotplug
15 [ "$(nvram get boardnum)" = "2" \
16 -o \
( "$(nvram get boardnum)" = "asusX" \
17 -a "$(($(nvram get et1phyaddr)))" -eq 1 \
) ] && ifname
="eth1"
20 insmod switch-robo || insmod switch-adm || rmmod switch-core
22 ifconfig
$ifname 192.168.1.1 netmask
255.255.255.0 broadcast
192.168.1.255 up
24 # save the boot loader's vlan config
25 # we need it on some routers that have no vlan*ports set
26 [ -d /proc
/switch
/eth0
] && {
27 export v0p
="$(cat /proc/switch/eth0/vlan/0/ports)"
28 export v1p
="$(cat /proc/switch/eth0/vlan/1/ports)"
29 export v2p
="$(cat /proc/switch/eth0/vlan/2/ports)"
30 echo 1 > /proc
/switch
/eth
0/reset
32 # this would be easier if we blasted the message across all ports
33 # but we don't want packets leaking across interfaces
35 for port
in $
(seq 0 4); do {
36 echo "$port 5u*" > /proc
/switch
/eth
0/vlan
/0/ports
37 netmsg
192.168.1.255 "Press reset now, to enter Failsafe!"
40 } || netmsg
192.168.1.255 "Press reset now, to enter Failsafe!"
44 lock
-w /tmp
/.failsafe
45 echo /sbin
/hotplug
> /proc
/sys
/kernel
/hotplug
47 ifconfig
$ifname 0.0.0.0 down
49 # revert to the boot loader's vlan config
50 # required for at least WRT54G v1.1
51 [ -d /proc
/switch
/eth0
] && {
52 echo "$v0p" > /proc
/switch
/eth
0/vlan
/0/ports
53 echo "$v1p" > /proc
/switch
/eth
0/vlan
/1/ports
54 echo "$v2p" > /proc
/switch
/eth
0/vlan
/2/ports