From dab5a4bae4f88e0c3dedc74c619f3ed9a28c6e4c Mon Sep 17 00:00:00 2001 From: Jordan Potter Date: Thu, 29 Jan 2026 08:06:45 -0800 Subject: [PATCH] Update entrypoint.sh to require exactly one configuration file (#51) Co-authored-by: Jordan Potter --- entrypoint.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0177dc7..30a3593 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,14 +8,16 @@ if [[ -z "$default_route_ip" ]]; then exit 1 fi -configs=`find /etc/wireguard -type f -printf "%f\n"` +configs=$(find /etc/wireguard -type f -printf "%f\n") if [[ -z "$configs" ]]; then echo "No configuration file found in /etc/wireguard" >&2 exit 1 +elif [[ $(echo "$configs" | wc -l) -gt 1 ]]; then + echo "Multiple configuration files found in /etc/wireguard, expected only one" >&2 + exit 1 fi -config=`echo $configs | head -n 1` -interface="${config%.*}" +interface="${configs%.*}" if [[ "$(cat /proc/sys/net/ipv4/conf/all/src_valid_mark)" != "1" ]]; then echo "sysctl net.ipv4.conf.all.src_valid_mark=1 is not set" >&2