2020-08-02 20:15:13 +00:00
|
|
|
#!/usr/bin/with-contenv bash
|
|
|
|
|
|
|
|
# Adapted from https://github.com/linuxserver/docker-wireguard
|
|
|
|
|
|
|
|
if [ "$ENABLE_WIREGUARD" = false ] ; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
_term() {
|
|
|
|
echo "Caught SIGTERM signal!"
|
2020-08-04 22:03:15 +00:00
|
|
|
wg-quick down /opt/wireguard/wg0.conf
|
2020-08-02 20:15:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trap _term SIGTERM
|
|
|
|
|
2020-08-04 22:03:15 +00:00
|
|
|
wg-quick up /opt/wireguard/wg0.conf
|
2020-08-02 20:15:13 +00:00
|
|
|
|
|
|
|
sleep infinity &
|
|
|
|
|
|
|
|
wait
|