16 lines
396 B
Bash
Executable File
16 lines
396 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ $1 == "d" || $1 == "down" ]]; then
|
|
nmcli con down wg0
|
|
elif [[ $1 == "u" || $1 == "up" ]]; then
|
|
nmcli con up wg0
|
|
elif [[ $1 == "import" ]]; then
|
|
nmcli connection add type wireguard file /etc/wireguard/wg0.conf
|
|
else
|
|
if [[ $(nmcli con show --active | grep wg0 | grep wireguard) == "" ]]; then
|
|
nmcli con up wg0
|
|
else
|
|
nmcli con down wg0
|
|
fi
|
|
fi
|