27 lines
366 B
Bash
Executable File

#!/bin/sh
set -e
if [ -z $DEVICE ]; then
DEVICE="tun0"
fi
if [ ! -f "/etc/wireguard/$DEVICE.conf" ]; then
cd /etc/wireguard
/create-config.sh
exit 0
fi
if [ "add-client" == "$1" ]; then
cd /etc/wireguard
/add-client.sh
exit 0
fi
echo "Starting wg-quick on $DEVICE"
touch "${WG_LOG_FILE}"
wg-quick up $DEVICE
echo "done!"
tail -f "${WG_LOG_FILE}"