Skip to content

Instantly share code, notes, and snippets.

@yzdann
Last active April 30, 2020 20:48
Show Gist options
  • Save yzdann/18ac4f528c48e3472bd0bf82d312af36 to your computer and use it in GitHub Desktop.
Save yzdann/18ac4f528c48e3472bd0bf82d312af36 to your computer and use it in GitHub Desktop.
cp wg-up-down.sh /usr/loca/bin/wg-up-down
chmod +x /usr/local/bin/wg-up-down
# set img
# add .desktop to ~/.config/xfce4/panel/launcher-x/
#!/usr/bin/bash
# we can go with || but readability counts :)
CONFIG_NAME="wg0"
ip r | grep $CONFIG_NAME > /dev/null
exit_status=$?
if [ $exit_status -eq 0 ]; then
wg-quick down $CONFIG_NAME
exit 0
fi
wg-quick up $CONFIG_NAME
[Desktop Entry]
Version=1.0
Type=Application
Name=WireGuard
Comment=
Exec=sudo wg-up-down
Icon=/home/yzdann/Pictures/icon/wireguard.png
Path=
Terminal=true
StartupNotify=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment