summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-ddns/root
diff options
context:
space:
mode:
authorChristian Schoenebeck <christian.schoenebeck@gmail.com>2014-11-09 18:37:15 +0100
committerChristian Schoenebeck <christian.schoenebeck@gmail.com>2014-11-09 18:37:15 +0100
commitee9fdba61744111d8f5d7f7d616992ac7135ac09 (patch)
tree8d20f47184b2a2f75a7b47ad26fe354b47b02b82 /applications/luci-ddns/root
parent92bfcbbc3463cbb7f384d688cb5f1c7e4bed326c (diff)
luci-app-ddns: Update to support ddns-scripts 2.1.0-1
fix verify of entry for DNS server Issue #244 https://github.com/openwrt/luci/issues/244 add support for option 'update_script' add display of version information when click on "Dynamic DNS" on overview page add verify of installed ddns-scripts version and show as hint if not correct version modified epoch to date conversation cbi object Flag did not set section.changed state, fixed in tools.flag_parse function ucitrack entry no longer needed and removed minor fixes Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'applications/luci-ddns/root')
-rwxr-xr-xapplications/luci-ddns/root/etc/uci-defaults/luci-ddns4
-rwxr-xr-xapplications/luci-ddns/root/usr/lib/ddns/dynamic_dns_lucihelper.sh42
2 files changed, 26 insertions, 20 deletions
diff --git a/applications/luci-ddns/root/etc/uci-defaults/luci-ddns b/applications/luci-ddns/root/etc/uci-defaults/luci-ddns
index f3bad58071..4849e59b7f 100755
--- a/applications/luci-ddns/root/etc/uci-defaults/luci-ddns
+++ b/applications/luci-ddns/root/etc/uci-defaults/luci-ddns
@@ -1,10 +1,8 @@
#!/bin/sh
-# needed for "Save and Apply" to restart ddns
+# no longer needed for "Save and Apply" to restart ddns
uci -q batch <<-EOF >/dev/null
delete ucitrack.@ddns[-1]
- add ucitrack ddns
- set ucitrack.@ddns[-1].init="ddns"
commit ucitrack
EOF
diff --git a/applications/luci-ddns/root/usr/lib/ddns/dynamic_dns_lucihelper.sh b/applications/luci-ddns/root/usr/lib/ddns/dynamic_dns_lucihelper.sh
index 1782d1f038..3fc84748ee 100755
--- a/applications/luci-ddns/root/usr/lib/ddns/dynamic_dns_lucihelper.sh
+++ b/applications/luci-ddns/root/usr/lib/ddns/dynamic_dns_lucihelper.sh
@@ -1,13 +1,14 @@
#!/bin/sh
# /usr/lib/ddns/luci_dns_helper.sh
#
-# Written by Christian Schoenebeck in August 2014 to support:
-# this script is used by luci-app-ddns
+# Written in August 2014
+# by Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+# This script is used by luci-app-ddns
# - getting registered IP
# - check if possible to get local IP
# - verifing given DNS- or Proxy-Server
#
-# variables in small chars are read from /etc/config/ddns
+# variables in small chars are read from /etc/config/ddns as parameter given here
# variables in big chars are defined inside these scripts as gloval vars
# variables in big chars beginning with "__" are local defined inside functions only
# set -vx #script debugger
@@ -18,13 +19,13 @@
# set -vx #script debugger
-# preset some variables wrong or not set in dynamic_dns_functions.sh
-SECTION_ID="dynamic_dns_lucihelper"
+# preset some variables, wrong or not set in dynamic_dns_functions.sh
+SECTION_ID="lucihelper"
LOGFILE="$LOGDIR/$SECTION_ID.log"
-LUCI_HELPER="ACTIV" # supress verbose and critical logging
+VERBOSE_MODE=0 # no console logging
# global variables normally set by reading DDNS UCI configuration
-use_logfile=0
-use_syslog=0
+use_syslog=0 # no syslog
+use_logfile=0 # by default no logfile, can be changed here
case "$1" in
get_registered_ip)
@@ -34,21 +35,24 @@ case "$1" in
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
force_dnstcp=${5:-"0"} # Force TCP on DNS - default 0 - No
dns_server=${6:-""} # DNS server - default No DNS
+ write_log 7 "-----> get_registered_ip IP"
get_registered_ip IP
[ $? -ne 0 ] && IP=""
echo -n "$IP" # suppress LF
;;
verify_dns)
- # $2 == dns-server to verify # no need for force_dnstcp because
+ # $2 : dns-server to verify # no need for force_dnstcp because
# verify with nc (netcat) uses tcp anyway
use_ipv6=${3:-"0"} # Use IPv6 - default IPv4
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
+ write_log 7 "-----> verify_dns '$2'"
verify_dns "$2"
;;
verify_proxy)
- # $2 == proxy string to verify
+ # $2 : proxy string to verify
use_ipv6=${3:-"0"} # Use IPv6 - default IPv4
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
+ write_log 7 "-----> verify_proxy '$2'"
verify_proxy "$2"
;;
get_local_ip)
@@ -62,7 +66,7 @@ case "$1" in
proxy="$8" # proxy if set
force_ipversion="0" # not needed but must be set
use_https="0" # not needed but must be set
- [ -n "$proxy" -a "$ip_source" == "web" ] && {
+ [ -n "$proxy" -a "$ip_source" = "web" ] && {
# proxy defined, used for ip_source=web
export HTTP_PROXY="http://$proxy"
export HTTPS_PROXY="http://$proxy"
@@ -70,13 +74,17 @@ case "$1" in
export https_proxy="http://$proxy"
}
# don't need IP only the return code
- [ "$ip_source" == "web" -o "$ip_source" == "script"] && {
- # we wait only 3 seconds for an
+ [ "$ip_source" = "web" -o "$ip_source" = "script" ] && {
+ # we wait only 3 seconds for an
# answer from "web" or "script"
- __timeout 3 -- get_local_ip IP
- } || get_local_ip IP
+ write_log 7 "-----> timeout 3 -- get_local_ip IP"
+ timeout 3 -- get_local_ip IP
+ } || {
+ write_log 7 "-----> get_local_ip IP"
+ get_local_ip IP
+ }
;;
- *)
- return 1
+ *)
+ return 255
;;
esac