From: Lin Fan Date: Sat, 7 Feb 2026 06:36:01 +0000 (+0800) Subject: ddns-script: update namesilo.com X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=8ce03e3065c9f987399b7719e7287ac969d1dcad;p=feed%2Fpackages.git ddns-script: update namesilo.com switch xml parser to xmllint because xmlstarlet is not available Signed-off-by: Lin Fan --- diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile old mode 100755 new mode 100644 index 658659fb7a..020c982296 --- 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:=90 +PKG_RELEASE:=91 PKG_LICENSE:=GPL-2.0 diff --git a/net/ddns-scripts/files/usr/lib/ddns/update_namesilo_com_v1.sh b/net/ddns-scripts/files/usr/lib/ddns/update_namesilo_com_v1.sh index 8c0bf129b6..1ed03ecf47 100755 --- a/net/ddns-scripts/files/usr/lib/ddns/update_namesilo_com_v1.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/update_namesilo_com_v1.sh @@ -6,9 +6,9 @@ # 2026 Lin Fan # # using following options from /etc/config/ddns -# username - sub domain +# domain - domain (e.g. example.com) +# username - sub domain (e.g. www) # password - api key -# domain - domain # # optional parameters (param_opt) from /etc/config/ddns # ttl - ttl in seconds (e.g. ttl=7200, default '3600') @@ -73,11 +73,11 @@ fmt=$(echo ${param_opt_fmt:-json} | tr 'A-Z' 'a-z') . /usr/share/libubox/jshn.sh } -# check xmlstarlet (optional) +# check xmllint (optional) [ "$fmt" == "xml" ] && { - XMLSTARLET=$(command -v xmlstarlet) - [ -z "$XMLSTARLET" ] && { - write_log 7 "Suggestion: install 'xmlstarlet' to parse XML response accurately" + XMLLINT=$(command -v xmllint) + [ -z "$XMLLINT" ] && { + write_log 7 "Suggestion: install 'libxml2-utils' to parse XML response accurately" } } @@ -106,9 +106,9 @@ get_code() { } # xml - [ -n "$XMLSTARLET" ] && { - # try xmlstarlet first - $XMLSTARLET sel -t -v "/namesilo/reply/code" 2>/dev/null + [ -n "$XMLLINT" ] && { + # try xmllint first + $XMLLINT --xpath "string(/namesilo/reply/code)" - 2>/dev/null } || { # fallback to grep/sed grep -o '.*' | sed 's///;s/<\/code>//' 2>/dev/null @@ -129,9 +129,9 @@ get_detail() { } # xml - [ -n "$XMLSTARLET" ] && { - # try xmlstarlet first - $XMLSTARLET sel -t -v "/namesilo/reply/detail" 2>/dev/null + [ -n "$XMLLINT" ] && { + # try xmllint first + $XMLLINT --xpath "string(/namesilo/reply/detail)" - 2>/dev/null } || { # fallback to grep/sed grep -o '.*' | sed 's///;s/<\/detail>//' 2>/dev/null @@ -166,15 +166,15 @@ get_rrid() { } # xml - [ -n "$XMLSTARLET" ] && { - # try xmlstarlet first - $XMLSTARLET sel -t -v "/namesilo/reply/resource_record/record_id[../host='${username}'][../type='${type}']" 2>/dev/null + [ -n "$XMLLINT" ] && { + # try xmllint first + $XMLLINT --xpath "string(/namesilo/reply/resource_record[host='$username'][type='$type']/record_id)" - 2>/dev/null } || { # fallback to grep/sed local record for record in $(sed "s//\n/g" | grep -o ".*$username.*") ; do - local rtyp=$(printf "%s\n" "$record" | sed "s/.*//;s/<\/type>.*//") + local rtyp=$(printf "%s\n" "$record" | sed "s/.*//;s/<\/type>.*//") [ "$rtyp" == "$type" ] && { printf "%s\n" "$record" | sed "s/.*//;s/<\/record_id>.*//" return