dsynth - Conditionally avoid passing PKG_SUFX make env
[dragonfly.git] / initrd / rescue / dowpa
1 #!/bin/sh
2
3 if [ $# != 3 ]; then
4     echo "dowpa <interface> <ssid> <password>"
5     exit 1
6 fi
7
8 ifc=$1
9 ssid=$2
10 pass=$3
11
12 killall -9 wpa_supplicant > /dev/null 2>&1
13 sleep 0.5
14 ifconfig wlan0 down > /dev/null 2>&1
15 ifconfig wlan0 destroy > /dev/null 2>&1
16 sleep 0.5
17
18 cat > /etc/wpa_supplicant.conf << EOF
19 network={
20     ssid="$ssid"
21     scan_ssid=1
22     psk="$3"
23 }
24 EOF
25
26 ifconfig wlan0 create wlandev $ifc
27 sleep 0.5
28 /sbin/wpa_supplicant -B -q -i wlan0 -c /etc/wpa_supplicant.conf -D bsd \
29          -P /var/run/wpa_supplicant/wlan0.pid
30