ddns-script: update namesilo.com
authorLin Fan <im.linfan@gmail.com>
Sat, 7 Feb 2026 06:36:01 +0000 (14:36 +0800)
committerFlorian Eckert <Eckert.Florian@googlemail.com>
Tue, 10 Feb 2026 08:00:22 +0000 (09:00 +0100)
switch xml parser to xmllint because xmlstarlet is not available

Signed-off-by: Lin Fan <im.linfan@gmail.com>
net/ddns-scripts/Makefile [changed mode: 0755->0644]
net/ddns-scripts/files/usr/lib/ddns/update_namesilo_com_v1.sh

old mode 100755 (executable)
new mode 100644 (file)
index 658659f..020c982
@@ -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
 
index 8c0bf129b63d20b68fcc18fea825c7d269eaa66f..1ed03ecf478a94b5ccf48669a413ec3d18788651 100755 (executable)
@@ -6,9 +6,9 @@
 # 2026 Lin Fan <im dot linfan at gmail dot com>
 #
 # 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 '<code>.*</code>' | sed 's/<code>//;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 '<detail>.*</detail>' | sed 's/<detail>//;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/<resource_record>/\n<resource_record>/g" |
                                                grep -o "<resource_record>.*<host>$username</host>.*</resource_record>") ; do
-                       local rtyp=$(printf "%s\n" "$record" | sed  "s/.*<type>//;s/<\/type>.*//")
+                       local rtyp=$(printf "%s\n" "$record" | sed "s/.*<type>//;s/<\/type>.*//")
                        [ "$rtyp" == "$type" ] && {
                                printf "%s\n" "$record" | sed "s/.*<record_id>//;s/<\/record_id>.*//"
                                return