Skip to content

Instantly share code, notes, and snippets.

@sunaku
Created April 9, 2014 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunaku/10286628 to your computer and use it in GitHub Desktop.
Save sunaku/10286628 to your computer and use it in GitHub Desktop.
chromeos-scripts
#!/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