Created
April 9, 2014 16:03
-
-
Save sunaku/10286628 to your computer and use it in GitHub Desktop.
chromeos-scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Connects to the VPN specified by the given vpnc(1) configuration file and | |
# then waits for you to interrupt or kill this process, at which time it | |
# disconnects the VPN. See https://github.com/dnschneid/crouton/wiki/VPNC | |
# | |
# Usage: chromeos-vpn VPNC_CONFIGURATION_FILE [OPTIONS_FOR_VPNC...] | |
# | |
# Setup: apt-get install vpnc wireless-tools | |
# | |
test $UID -eq 0 || { echo "$0: Please run this command as root."; exit 1; } | |
function ensure { | |
set +e | |
vpnc-disconnect | |
iwconfig wlan0 power on | |
pkill -f "croutonpowerd -i" | |
} | |
trap ensure EXIT | |
set -ex | |
vpnc --ifmode tap "$@" | |
iwconfig wlan0 power off | |
croutonpowerd -i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment