您尚未登录。

楼主 #1 2017-11-01 10:24:12

daydayup
会员
注册时间: 2017-10-09
已发帖子: 343
积分: 343

/sbin/widora_mode 原来是用uci脚本实现的

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
;;
esac

else
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

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn


东莞哇酷科技有限公司开发