From 738a39c717afb2b574a3b79a74640bd0be5f5900 Mon Sep 17 00:00:00 2001 From: Jens Nachtigall Date: Fri, 27 Sep 2024 02:11:51 +0200 Subject: [PATCH] ddns-scripts: allow for commands in $ip_script Signed-off-by: Jens Nachtigall --- net/ddns-scripts/Makefile | 2 +- net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index 0561f995848c2..956296f96ab2d 100644 --- a/net/ddns-scripts/Makefile +++ b/net/ddns-scripts/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ddns-scripts PKG_VERSION:=2.8.2 -PKG_RELEASE:=48 +PKG_RELEASE:=49 PKG_LICENSE:=GPL-2.0 diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh index e6f91e8ee08f5..7c63e175238de 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh @@ -149,7 +149,7 @@ trap "trap_handler 15" 15 # SIGTERM Termination # ip_source source to detect current IP ('network' or 'web' or 'script' or 'interface') # ip_network local defined network to read IP from i.e. 'wan' or 'wan6' # ip_url URL to read current IP from i.e. http://checkip.dyndns.com/ or http://checkipv6.dyndns.com/ -# ip_script full path and name of your script to detect current IP +# ip_script either full path and name of your script or single (Ash-compatible) statement to detect current IP # ip_interface physical interface to use for detecting # # check_interval check for changes every !!! checks below 10 minutes make no sense because the Internet @@ -282,7 +282,8 @@ esac if [ "$ip_source" = "script" ]; then set -- $ip_script #handling script with parameters, we need a trick [ -z "$1" ] && write_log 14 "No script defined to detect current IP!" - [ -x "$1" ] || write_log 14 "Script to detect current IP not executable!" + [ -f "$1" -a ! -x "$1" ] && write_log 14 "Script to detect current IP not executable!" + [ ! -f "$1" ] && ( command -v "$1" > /dev/null 2>&1 || write_log 14 "Script to detect current IP: File or command not found!" ) fi # compute update interval in seconds