1
0
Fork 0
chezmoi/bin/executable_jwg
2024-03-08 22:38:07 +01:00

39 lines
681 B
Bash

#!/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