#!/bin/env bash set -e if [ "$EUID" -eq 0 ]; then echo "Don't use sudo/root pls" exit fi if ! wg &>/dev/null; then wg-quick down wg0 || wg-quick down wg1 echo "Disconnected from Wireguard!" exit fi if sudo pppstats &>/dev/null; then sudo poff uni echo "Disconnected from Universität Tübingen!" exit fi read -p "[U]ni, [T]übingen or [L]angenau? " -n 1 -r echo if [[ $REPLY =~ ^[Uu]$ ]]; then sudo pon uni echo "Connected to Universität Tübingen!" exit elif [[ $REPLY =~ ^[Ll]$ ]]; then wg-quick up wg0 echo "Connected to Langenau Eaglefit!" exit elif [[ $REPLY =~ ^[Tt]$ ]]; then wg-quick up wg1 echo "Connected to Tübingen home!" exit fi