root@Widora:/tmp/run/mountd/mmcblk0p1# cat /sbin/widora_mode
#!/bin/sh
if [ -n "$1" ];then
wifi down
sleep 1
case $1 in
repeater) #repeater mode
if [ -n "$2" ];then
uci set wireless.sta.ssid="$2"
if [ -n "$3" ];then
uci set wireless.sta.key="$3"
else
uci delete wireless.sta.key
fi
fi
uci set wireless.sta.network=lan
uci set wireless.sta.disabled=0
uci set wireless.ap.hidden=0
uci set dhcp.lan.ignore=1
uci set network.lan.proto='dhcp'
uci set network.lan.ifname='eth0'
uci delete network.wan
uci commit
/etc/init.d/network restart
;;
client) #client mode
if [ -n "$2" ];then
uci set wireless.sta.ssid="$2"
if [ -n "$3" ];then
uci set wireless.sta.key="$3"
else
uci delete wireless.sta.key
fi
fi
uci set wireless.sta.disabled=0
uci set wireless.sta.network=wan
uci set wireless.ap.hidden=1
uci set network.wan=interface
uci set network.wan.ifname='apcli0'
uci set network.wan.proto='dhcp'
uci set dhcp.lan.ignore=0
uci set network.lan.proto=static
uci set network.lan.ifname='eth0'
uci commit
/etc/init.d/network restart
;;
router) #router mode
uci set wireless.sta.network=wan
uci set wireless.sta.disabled=1
uci set wireless.ap.hidden=0
uci set dhcp.lan.ignore=0
uci set network.lan.proto=static
uci delete network.lan.ifname
uci set network.wan=interface
uci set network.wan.ifname='eth0'
uci set network.wan.proto='dhcp'
uci commit
/etc/init.d/network restart
;;
pppoe) #pppoe mode
uci set wireless.sta.network=wan
uci set wireless.sta.disabled=1
uci set wireless.ap.hidden=0
uci set dhcp.lan.ignore=0
uci set network.lan.proto=static
uci delete network.lan.ifname
uci set network.wan=interface
uci set network.wan.ifname='eth0'
uci set network.wan.proto='pppoe'
[ -n "$2" ] && uci set network.wan.username="$2"
[ -n "$3" ] && uci set network.wan.password="$3"
uci commit
/etc/init.d/network restart
;;
esacelse
echo "---------------------------------------------------"
echo "widora_mode help"
echo "MODE | REPEATER | CLIENT | ROUTER PPPOE |"
echo "LAN | eth0 ra0 apcli0| eth0 | ra0 |"
echo "WAN | | apcli0 | eth0 |"
echo "\"widora_mode repeater\""
echo "\"widora_mode repeater ssid key\""
echo "\"widora_mode client\""
echo "\"widora_mode client ssid key\""
echo "\"widora_mode router\""
echo "\"widora_mode pppoe\""
echo "\"widora_mode pppoe user_name password\""
echo "---------------------------------------------------"
fi
离线