diff --git a/wireguard/Dockerfile b/wireguard/Dockerfile index b62983b..3f3fd37 100644 --- a/wireguard/Dockerfile +++ b/wireguard/Dockerfile @@ -17,6 +17,6 @@ RUN dnf install -y \ chmod +x /usr/bin/entrypoint.sh && \ mkdir /setup.d -STOPSIGNAL SIGALRM +STOPSIGNAL SIGINT ENTRYPOINT [ "/usr/bin/entrypoint.sh" ] diff --git a/wireguard/entrypoint.sh b/wireguard/entrypoint.sh index b67c7db..0dbc8e0 100644 --- a/wireguard/entrypoint.sh +++ b/wireguard/entrypoint.sh @@ -1,11 +1,22 @@ #!/bin/bash +stopcontainer() +{ + echo "removing wg0 interface" + wg-quick down /data/wg0.conf + echo goodbye + exit 0 +} + +trap stopcontainer SIGINT + for file in /setup.d/*; do echo "Executing setup file $file"; bash -c "$file"; done -wg-quick up /data/wg0.conf && sleep infinity -echo "removing wg0 interface" -wg-quick down /data/wg0.conf +wg-quick up /data/wg0.conf + +while true; do sleep 5; done +