Browse Source

Update entrypoint.sh to require exactly one configuration file (#51)

Co-authored-by: Jordan Potter <[email protected]>
main
Jordan Potter 4 months ago
committed by GitHub
parent
commit
dab5a4bae4
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      entrypoint.sh

8
entrypoint.sh

@ -8,14 +8,16 @@ if [[ -z "$default_route_ip" ]]; then
exit 1 exit 1
fi fi
configs=`find /etc/wireguard -type f -printf "%f\n"` configs=$(find /etc/wireguard -type f -printf "%f\n")
if [[ -z "$configs" ]]; then if [[ -z "$configs" ]]; then
echo "No configuration file found in /etc/wireguard" >&2 echo "No configuration file found in /etc/wireguard" >&2
exit 1 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 fi
config=`echo $configs | head -n 1` interface="${configs%.*}"
interface="${config%.*}"
if [[ "$(cat /proc/sys/net/ipv4/conf/all/src_valid_mark)" != "1" ]]; then 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 echo "sysctl net.ipv4.conf.all.src_valid_mark=1 is not set" >&2

Loading…
Cancel
Save