#!/bin/bash enable() { if [[ -e /etc/systemd/network/jopixel.netdev ]] then echo 'Config already enabled' elif [[ ! -e /etc/systemd/network/jopixel.netdev.disabled ]] then echo 'No disabled config found!' else mv -v /etc/systemd/network/jopixel.netdev{.disabled,} fi systemctl restart systemd-networkd } disable() { if [[ -e /etc/systemd/network/jopixel.netdev ]] then mv -v /etc/systemd/network/jopixel.netdev{,.disabled} else echo 'No config found!' fi networkctl delete jopixel systemctl restart systemd-networkd } if (( "$(id -u)" != 0 )) then exec sudo "$0" "$@" fi case "$1" in enable|up) enable ;; disable|down) disable ;; *) wg ;; esac