nsbin/wlan

50 lines
1 KiB
Text
Raw Normal View History

#!/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.
#
#
#ip link set wlp0s3 down
#iwconfig wlp0s3 essid public
#ip link set wlp0s3 up
#iwconfig wlp0s3 essid public
if [ "$#" -ge 1 ]; then
dev=$1; shift
else
dev=wlp2s0
dev=wlp3s0
dev=wlan0
dev=wlp1s0
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
# Give wpa some time to connect
sleep 5
# Choose an dhcp client
( udhcpc -nqfi $dev || dhcpcd )
# vpnc ~nico/ethz/vpn/sg.conf
#vpnc ~nico/firmen/ethz/vpn/vpnc.conf
# vpnc-disconnect