2008-11-28 11:44:14 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
# Nico Schottelius, 20080910 11:09
|
2009-04-17 18:09:01 +00:00
|
|
|
# The initial version
|
|
|
|
#
|
2013-10-26 21:28:38 +00:00
|
|
|
# udhcpc -nfqi wlp0s3 && vpnc ~nico/ethz/vpn/pc.conf
|
2009-04-17 18:09:01 +00:00
|
|
|
#
|
|
|
|
# Failed due to many reasons. See the working hack/version below.
|
|
|
|
#
|
|
|
|
#
|
2013-10-26 21:28:38 +00:00
|
|
|
#ip link set wlp0s3 down
|
|
|
|
#iwconfig wlp0s3 essid public
|
|
|
|
#ip link set wlp0s3 up
|
|
|
|
#iwconfig wlp0s3 essid public
|
|
|
|
|
2014-02-26 13:24:29 +00:00
|
|
|
if [ "$#" -ge 1 ]; then
|
|
|
|
dev=$1; shift
|
|
|
|
else
|
|
|
|
dev=wlp2s0
|
|
|
|
dev=wlp3s0
|
|
|
|
dev=wlan0
|
|
|
|
dev=wlp1s0
|
|
|
|
fi
|
2009-01-30 11:28:47 +00:00
|
|
|
|
|
|
|
set -x
|
2013-10-26 21:28:38 +00:00
|
|
|
set +e
|
|
|
|
wpa_cli terminate || true
|
|
|
|
#rmmod b43 bcma
|
|
|
|
sleep 1
|
|
|
|
#modprobe b43
|
|
|
|
set -e
|
2009-01-30 11:28:47 +00:00
|
|
|
|
2010-07-12 20:47:21 +00:00
|
|
|
#ip l s eth0 down
|
2011-10-08 12:44:17 +00:00
|
|
|
# Ensure previous wpa_supplicant is not running
|
2010-04-15 10:21:43 +00:00
|
|
|
( wpa_cli terminate || exit 0 )
|
2009-08-14 12:04:06 +00:00
|
|
|
|
2011-10-08 12:44:17 +00:00
|
|
|
# Ensure the adapter works, reloading the driver helps
|
2013-10-26 21:28:38 +00:00
|
|
|
# ( rmmod iwlagn; modprobe iwlagn; sleep 2 )
|
2009-08-14 12:04:06 +00:00
|
|
|
|
2013-10-26 21:28:38 +00:00
|
|
|
# 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
|
2011-10-08 12:44:17 +00:00
|
|
|
# Give wpa some time to connect
|
2009-01-30 11:28:47 +00:00
|
|
|
sleep 5
|
2011-10-08 12:44:17 +00:00
|
|
|
|
|
|
|
# Choose an dhcp client
|
2013-10-26 21:28:38 +00:00
|
|
|
( udhcpc -nqfi $dev || dhcpcd )
|
2009-01-30 11:28:47 +00:00
|
|
|
|
2011-10-08 12:44:17 +00:00
|
|
|
# vpnc ~nico/ethz/vpn/sg.conf
|
2009-01-30 11:28:47 +00:00
|
|
|
#vpnc ~nico/firmen/ethz/vpn/vpnc.conf
|
|
|
|
# vpnc-disconnect
|