中校
科技痴
- 注册时间
- 2013-2-16
- 金币
- 4261 个
- 威望
- 1 个
- 荣誉
- 0 个
累计签到:334 天 连续签到:0 天 [LV.365]无线熟人
|
回帖奖励 +1 个金币
本帖最后由 Alpha-X 于 2015-8-29 22:10 编辑
命令行操作的,未必适合小白…… 多数人都喜欢图形界面……
- cat ~/bin/wisp
- #!/bin/sh
- ifnum=1
- radio=radio1
- abc() {
- ESSID='abc'
- BSSID='xx:xx:xx:xx:xx:xx'
- ENCR='wep-open'
- KEY='...'
- }
- xyz () {
- ESSID='xyz'
- BSSID='xx:xx:xx:xx:xx:xx'
- ENCR='psk2'
- KEY='...'
- }
- if [ "$1" == "ls" -o "$1" == "list" ]; then
- echo "targets available = abc | xyz "
- exit 0
- elif [ "$1" == "show" ]; then
- uci show wireless.$radio
- uci show wireless.@wifi-iface[$ifnum]
- exit 0
- elif [ "$1" == "help" -o "$1" == "" ]; then
- echo "usage: $0 [ <target> | list | ls | show | help ]"
- exit 0
- else
- $1
- [ "$ESSID" == "" ] && exit 1
- uci batch << EOF
- set wireless.$radio.channel=auto
- set wireless.@wifi-iface[$ifnum].device=$radio
- set wireless.@wifi-iface[$ifnum].mode=sta
- set wireless.@wifi-iface[$ifnum].ssid="$ESSID"
- set wireless.@wifi-iface[$ifnum].bssid="$BSSID"
- set wireless.@wifi-iface[$ifnum].encryption="$ENCR"
- set wireless.@wifi-iface[$ifnum].key="$KEY"
- set wireless.@wifi-iface[$ifnum].disabled=0
- commit wireless
- EOF
- wifi down && wifi
- fi
复制代码
还有其它的 /etc/config/network 和 /etc/config/dhcp 等都是固定、手动设置的,脚本并没有去动它……
简单容易…… 因为它适合我。
|
|