2020-09-13 12:00:51 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2020-10-14 14:36:21 +00:00
|
|
|
SCRIPT=$(readlink -f "$0")
|
|
|
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
|
|
|
|
|
|
source "$SCRIPTPATH/wireguard-config.sh"
|
2020-09-13 12:00:51 +00:00
|
|
|
|
|
|
|
if nmcli connection show --active | grep "$ID_LIGHT" > /dev/null
|
|
|
|
then
|
|
|
|
nmcli connection up "$ID_FULL"
|
2020-10-14 14:45:01 +00:00
|
|
|
nmcli connection down "$ID_LIGHT"
|
2020-09-13 12:00:51 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if nmcli connection show --active | grep "$ID_FULL" > /dev/null
|
|
|
|
then
|
2020-10-14 14:45:01 +00:00
|
|
|
nmcli connection up "$ID_LIGHT"
|
|
|
|
nmcli connection down "$ID_FULL"
|
2020-09-13 12:00:51 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
nmcli connection up "$ID_LIGHT"
|