Fix broken bash script value edge-case

This commit is contained in:
Root User 2026-03-03 12:50:41 +01:00
parent d8d7e721a1
commit 44a32b9c9f
Signed by: root
GPG key ID: 087F0A95E5766D72

View file

@ -614,8 +614,11 @@ in {
)
# Try all the ip services for a valid IPv4 address
for service in $${IP_SERVICES[@]}; do
RAW_IP=$(${pkgs.curl}/bin/curl -s $service)
for service in "$${IP_SERVICES[@]}"; do
echo "Testing service: $service"
RAW_IP=$(curl -s "$service")
RAW_IP=$(echo "$RAW_IP" | tr -d '\n' | tr -d '\r' | xargs)
echo "RAW_IP: '$RAW_IP'"
if [[ $RAW_IP =~ $REGEX_IPV4 ]]; then
CURRENT_IP=$BASH_REMATCH
${pkgs.util-linux}/bin/logger -s "DDNS Updater: Fetched IP $CURRENT_IP"