#!/bin/sh # Start/stop/restart wifi. # Start wifi: wifi_start() { if [ -x /usr/local/bin/wpa_supplicant ]; then echo "Starting wireless with WPA encryption" modprobe ndiswrapper ifconfig wlan0 up iwconfig wlan0 essid myessid /usr/local/bin/wpa_supplicant -c /etc/wpa_supplicant.conf -D ndiswrapper -i wlan0 -Bw dhcpcd wlan0 fi } # Stop wifi: wifi_stop() { ifconfig wlan0 down killall wpa_supplicant rm /etc/dhcpc/dhcpcd-wlan0.pid } # Restart wifi: wifi_restart() { wifi_stop sleep 1 wifi_start } case "$1" in 'start') wifi_start ;; 'stop') wifi_stop ;; 'restart') wifi_restart ;; *) echo "usage $0 start|stop|restart" esac