wifi_client.sh:这个放在rc.local开机运行
#!/bin/sh /etc/init.d/operate_wifi install ifconfig mlan0 up wpa_supplicant -Bddd -Dnl80211 -imlan0 -c /etc/wpa_supplicant.conf wpa_cli -a/etc/init.d/wpa_action.sh -imlan0 -Bwpa_action.sh:放在/etc/init.d/目录下,需要可执行权限,wifi_client.sh会调用
#!/bin/sh IFNAME=$1 CMD=$2 if [ "$CMD" = "CONNECTED" ]; then echo connect $IFNAME, udhcpc for it > /dev/console udhcpc -i $IFNAME -n fi if [ "$CMD" = "DISCONNECTED" ]; then echo disconnect $IFNAME, kill udhcpc for it > /dev/console killall udhcpc fiwpa_supplicant.conf:wifi连接的AP名称和密码配置文件
ctrl_interface=/var/run/wpa_supplicant update_config=1 ap_scan=1 network={ ssid="GTSWIFI" #psk="12345678" psk=35044d00eb90fb6e4a91cbb0e704d3d3bee01793a547cee508db36aadb07630a }连接的wifi的ssid和密码可以用以下命令生成:
wpa_passphrase essid passphrase > tmp.conf就这样配置好后就可以自动连接咯~Good Luck