aboutsummaryrefslogtreecommitdiff
path: root/net/ddns-scripts/files/usr/lib
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2020-09-28 15:12:03 +0200
committerFlorian Eckert <fe@dev.tdt.de>2020-09-28 15:28:27 +0200
commit8d10cdda08445123067847aa748bcece528664c0 (patch)
treea8b64f9960511549d2e1eb2b4bc5ee12ccd9d11f /net/ddns-scripts/files/usr/lib
parent8be604072cbe9652f608dcd6671ae8b029f3fbaa (diff)
ddns-scripts: also read providers from custom directory
The provider could also be read from the custom directory. To get always the latest version of the provider config json file, we read first the custom directory and after that we also check the default directory, if we could not find the provider file Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'net/ddns-scripts/files/usr/lib')
2 files changed, 11 insertions, 6 deletions
diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
index d59fed440..a5698d7f2 100644
--- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
+++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
@@ -317,17 +317,18 @@ urlencode() {
}
# extract url or script for given DDNS Provider from
-# directory /usr/share/ddns/default
# $1 Name of the provider
-# $1 Name of Variable to store url to
-# $2 Name of Variable to store script to
-# $3 Name of Variable to store service answer to
+# $2 Provider directory
+# $3 Name of Variable to store url to
+# $4 Name of Variable to store script to
+# $5 Name of Variable to store service answer to
get_service_data() {
local provider="$1"
shift
+ local dir="$1"
+ shift
. /usr/share/libubox/jshn.sh
- local dir="/usr/share/ddns/default"
local name data url answer script
[ $# -ne 3 ] && write_log 12 "Error calling 'get_service_data()' - wrong number of parameters"
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 9e75552d9..41bc6f825 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
@@ -233,7 +233,11 @@ esac
# otherwise update_url is set inside configuration (custom update url)
# or update_script is set inside configuration (custom update script)
[ -n "$service_name" ] && {
- get_service_data "$service_name" update_url update_script UPD_ANSWER
+ # Check first if we have a custom service provider with this name
+ get_service_data "$service_name" "/usr/share/ddns/custom" update_url update_script UPD_ANSWER
+ if [ "$?" != "0" ]; then
+ get_service_data "$service_name" "/usr/share/ddns/default" update_url update_script UPD_ANSWER
+ fi
}
[ -z "$update_url" -a -z "$update_script" ] && write_log 14 "No update_url found/defined or no update_script found/defined!"