docker-wireguard/entrypoint.sh

24 lines
345 B
Bash
Raw Normal View History

2019-02-14 21:03:36 +01:00
#!/bin/bash
set -e
interfaces=`find /etc/wireguard -type f`
if [[ -z $interfaces ]]; then
echo "No interface found in /etc/wireguard" >&2
exit 1
fi
interface=`echo $interfaces | head -n 1`
wg-quick up $interface
shutdown () {
wg-quick down $interface
exit 0
}
trap shutdown SIGTERM SIGINT SIGQUIT
sleep infinity &
wait $!