ddns-scripts: drop split_FQDN()
authorPaul Donald <[email protected]>
Fri, 11 Apr 2025 13:02:28 +0000 (15:02 +0200)
committerFlorian Eckert <[email protected]>
Wed, 25 Jun 2025 13:40:21 +0000 (15:40 +0200)
The function is unused - it can be removed.

Signed-off-by: Paul Donald <[email protected]>
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh
net/ddns-scripts/files/usr/lib/ddns/update_huaweicloud_com.sh

index 3beb52e98d09e1494c2999dcad3e52c9dfa9fffd..79da24be9cb0a7e95a035382dd372535fbcb5fee 100644 (file)
@@ -37,7 +37,6 @@ UPDFILE=""            # store UPTIME of last update
 DATFILE=""             # save stdout data of WGet and other external programs called
 ERRFILE=""             # save stderr output of WGet and other external programs called
 IPFILE=""              # store registered IP for read by LuCI status
-TLDFILE=/usr/share/public_suffix_list.dat.gz   # TLD file used by split_FQDN
 
 CHECK_SECONDS=0                # calculated seconds out of given
 FORCE_SECONDS=0                # interval and unit
@@ -1153,78 +1152,6 @@ trap_handler() {
        [ $1 -gt 0 ] && kill -$1 $$
 }
 
-split_FQDN() {
-       # $1    FQDN to split
-       # $2    name of variable to store TLD
-       # $3    name of variable to store (reg)Domain
-       # $4    name of variable to store Host/Subdomain
-
-       [ $# -ne 4 ] && write_log 12 "Error calling 'split_FQDN()' - wrong number of parameters"
-       [ -z "$1"  ] && write_log 12 "Error calling 'split_FQDN()' - missing FQDN to split"
-       [ -f $TLDFILE ] || write_log 12 "Error calling 'split_FQDN()' - missing file '$TLDFILE'"
-
-       local _HOST _FDOM _CTLD _FTLD
-       local _SET="$@"                                 # save given function parameters
-
-       local _PAR=$(echo "$1" | tr [A-Z] [a-z] | tr "." " ")   # to lower and replace DOT with SPACE
-       set -- $_PAR                                    # set new as function parameters
-       _PAR=""                                         # clear variable for later reuse
-       while [ -n "$1" ] ; do                          # as long we have parameters
-               _PAR="$1 $_PAR"                         # invert order of parameters
-               shift
-       done
-       set -- $_PAR                                    # use new as function parameters
-       _PAR=""                                         # clear variable
-
-       while [ -n "$1" ] ; do                          # as long we have parameters
-               if [ -z "$_CTLD" ]; then                # first loop
-                       _CTLD="$1"                      # CURRENT TLD to look at
-                       shift
-               else
-                       _CTLD="$1.$_CTLD"               # Next TLD to look at
-                       shift
-               fi
-               # check if TLD exact match in tld_names.dat, save TLD
-               zcat $TLDFILE | grep -E "^$_CTLD$" >/dev/null 2>&1 && {
-                       _FTLD="$_CTLD"          # save found
-                       _FDOM="$1"              # save domain next step might be invalid
-                       continue
-               }
-               # check if match any "*" in tld_names.dat,
-               zcat $TLDFILE | grep -E "^\*.$_CTLD$" >/dev/null 2>&1 && {
-                       [ -z "$1" ] && break    # no more data break
-                       # check if next level TLD match excludes "!" in tld_names.dat
-                       if zcat $TLDFILE | grep -E "^!$1.$_CTLD$" >/dev/null 2>&1 ; then
-                               _FTLD="$_CTLD"  # Yes
-                       else
-                               _FTLD="$1.$_CTLD"
-                               shift
-                       fi
-                       _FDOM="$1"; shift
-               }
-               [ -n "$_FTLD" ] && break        # we have something valid, break
-       done
-
-       # the leftover parameters are the HOST/SUBDOMAIN
-       while [ -n "$1" ]; do
-               _HOST="$1 $_HOST"               # remember we need to invert
-               shift
-       done
-       _HOST=$(echo $_HOST | tr " " ".")       # insert DOT
-
-       set -- $_SET                            # set back parameters from function call
-       [ -n "$_FTLD" ] && {
-               eval "$2=$_FTLD"                # set TLD
-               eval "$3=$_FDOM"                # set registrable domain
-               eval "$4=$_HOST"                # set HOST/SUBDOMAIN
-               return 0
-       }
-       eval "$2=''"            # clear TLD
-       eval "$3=''"            # clear registrable domain
-       eval "$4=''"            # clear HOST/SUBDOMAIN
-       return 1
-}
-
 expand_ipv6() {
        # Original written for bash by
        #.Author:  Florian Streibelt <[email protected]>
index 17cd7c02430e28932f76aa1be20659b6be4a10a4..28861c7c6e80a72b8d26ec42dfbce2ef9070f89d 100644 (file)
@@ -13,7 +13,7 @@
 # using following options from /etc/config/ddns
 # option username  - your cloudflare e-mail
 # option password  - cloudflare api key, you can get it from cloudflare.com/my-account/
-# option domain    - "[email protected]" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
+# option domain    - "[email protected]"
 #
 # The proxy status would not be changed by this script. Please change it in Cloudflare dashboard manually.
 #
index 1ce866cd4d8919ea3d2354c2169cee00af33d3ed..32c09ed4365e0a162c56802d7ea6431e34f77e38 100644 (file)
@@ -11,7 +11,7 @@
 # using following options from /etc/config/ddns
 # option username  - huaweicloud Access Key Id
 # option password  - huaweicloud Secret Access Key,AK、SK documentation from https://support.huaweicloud.com/devg-apisign/api-sign-provide-aksk.html
-# option domain    - "[email protected]" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
+# option domain    - "[email protected]"
 # 
 
 # Check inputs