3 if [ -f /tmp
/ethernet.state1
]; then
4 rm /tmp
/ethernet.state1
6 if [ -f /tmp
/ethernet.state2
]; then
7 rm /tmp
/ethernet.state2
9 if [ -f /tmp
/ethernet.state3
]; then
10 rm /tmp
/ethernet.state3
13 VWAN
=`nvram get wan_ifname`
14 VPORT
=`nvram get $VWAN'ports' | awk '{print $1}'`
16 /usr
/sbin
/robocfg showports |
grep Port |
awk '{print $1" "$2" "$3}' > /tmp
/ethernet.state.tmp
19 SWAN
=`cat /tmp/ethernet.state.tmp | grep "Port $VPORT" | awk '{print $3}'`
20 echo "Port 0: $SWAN" > /tmp
/ethernet.state
21 sed -n -e "/Port $VPORT:/!p" /tmp
/ethernet.state.tmp
> /tmp
/ethernet.state1
22 sed -i '/Port 5/d' /tmp
/ethernet.state1
23 sed -i '/Port 8/d' /tmp
/ethernet.state1
26 REVERT
=`nvram get lan_invert`
27 if [ "$REVERT" == "1" ]; then
28 cat /tmp
/ethernet.state1 |
sort -r >> /tmp
/ethernet.state2
29 exec 0< /tmp
/ethernet.state2
33 STATE
=`echo $line | awk '{print $3}'`
34 echo "Port $NUM: $STATE" >> /tmp
/ethernet.state3
39 exec 0< /tmp
/ethernet.state1
43 STATE
=`echo $line | awk '{print $3}'`
44 echo "Port $NUM: $STATE" >> /tmp
/ethernet.state3
49 cat /tmp
/ethernet.state3
>> /tmp
/ethernet.state
51 if [ -f /tmp
/ethernet.state1
]; then
52 rm /tmp
/ethernet.state1
54 if [ -f /tmp
/ethernet.state2
]; then
55 rm /tmp
/ethernet.state2
57 if [ -f /tmp
/ethernet.state3
]; then
58 rm /tmp
/ethernet.state3