nsbin/wlan
2017-03-08 07:37:05 +01:00

50 lines
1.1 KiB
Bash
Executable file

#!/bin/sh -e
# Nico Schottelius, 20080910 11:09
# The initial version
#
# udhcpc -nfqi wlp0s3 && vpnc ~nico/ethz/vpn/pc.conf
#
# Failed due to many reasons. See the working hack/version below.
#
if [ "$#" -ge 1 ]; then
dev=$1; shift
else
dev=wlp3s0
dev=wlan0
dev=wlp2s0
dev=wlp1s0
dev=wlp4s0
dev=wlp3s0
fi
set -x
set +e
wpa_cli terminate || true
#rmmod b43 bcma
sleep 1
#modprobe b43
set -e
#ip l s eth0 down
# Ensure previous wpa_supplicant is not running
( wpa_cli terminate || exit 0 )
# Ensure the adapter works, reloading the driver helps
# ( rmmod iwlagn; modprobe iwlagn; sleep 2 )
# wpa_supplicant -B -Dwext -iwlp0s3 -c /etc/wpa_supplicant/wpa_supplicant.conf
# wpa_supplicant -B -Dwext -i$dev -c /etc/wpa_supplicant/wpa_supplicant.conf
#wpa_supplicant -B -Dnl80211 -i$dev -c /etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant -B -Dnl80211 -i$dev -c /etc/wpa_supplicant/wpa_supplicant-${dev}.conf
# Give wpa some time to connect
sleep 5
# Choose an dhcp client
( udhcpc -nqfi $dev || dhcpcd )
wpa_cli
# vpnc ~nico/ethz/vpn/sg.conf
#vpnc ~nico/firmen/ethz/vpn/vpnc.conf
# vpnc-disconnect