dotfiles-remastered/.config/polybar/wireguard-switch.sh

25 lines
467 B
Bash
Executable File

#!/usr/bin/env sh
set -e
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
source "$SCRIPTPATH/wireguard-config.sh"
if nmcli connection show --active | grep "$ID_LIGHT" > /dev/null
then
nmcli connection up "$ID_FULL"
nmcli connection down "$ID_LIGHT"
exit 0
fi
if nmcli connection show --active | grep "$ID_FULL" > /dev/null
then
nmcli connection up "$ID_LIGHT"
nmcli connection down "$ID_FULL"
exit 0
fi
nmcli connection up "$ID_LIGHT"