From 5d7c9f0ca4af19fb0092405876ed4622b2733320 Mon Sep 17 00:00:00 2001 From: NyneR Date: Sat, 11 Dec 2021 17:49:20 +0100 Subject: [PATCH] Add IPCOMMAND directive Added "IPCOMMAND" to provide a way to specify the IP without using curl. --- nsupdate.d/dist.config.sample | 3 +++ nsupdate.sh | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/nsupdate.d/dist.config.sample b/nsupdate.d/dist.config.sample index aad54e9..5bc3a4b 100755 --- a/nsupdate.d/dist.config.sample +++ b/nsupdate.d/dist.config.sample @@ -44,6 +44,9 @@ LOG="$0.log" # inspecting the target URL of the save button. #INWX_DOMAIN_ID="123456789" +# Provide a command to get the Ip instead of using Curl +#IPCOMMAND="" + # Use IPv6 connection. # deprecated option for backward compatibility, use TYPE instead #IPV6="NO" diff --git a/nsupdate.sh b/nsupdate.sh index a9a39f4..76df95d 100755 --- a/nsupdate.sh +++ b/nsupdate.sh @@ -94,7 +94,11 @@ if ls $(dirname $0)/nsupdate.d/*.config &> /dev/null; then fi # WAN_IP=`curl -s -$CONNECTION_TYPE ${IP_CHECK_SITE}| grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'` - WAN_IP=$(curl -s -$CONNECTION_TYPE ${IP_CHECK_SITE}) + if [[ -n "$IPCOMMAND" ]]; then + WAN_IP=$($IPCOMMAND) + else + WAN_IP=$(curl -s -$CONNECTION_TYPE ${IP_CHECK_SITE}) + fi # This is relevant for getting the specific domain record id. API_XML_INFO="