浏览代码

ddns-scripts: update to version 2.3.0-1

new option "use_curl" to force the use of curl if GNU Wget and curl are installed
fix initscript reload(): reload and not restart if killall -1 fails
BusyBox nc not support -v in every compiled version

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Christian Schoenebeck 10 年前
父节点
当前提交
5731d0e52d

+ 3
- 3
net/ddns-scripts/Makefile 查看文件

3
 PKG_NAME:=ddns-scripts
3
 PKG_NAME:=ddns-scripts
4
 # Version == major.minor.patch
4
 # Version == major.minor.patch
5
 # increase on new functionality (minor) or patches (patch)
5
 # increase on new functionality (minor) or patches (patch)
6
-PKG_VERSION:=2.2.0
6
+PKG_VERSION:=2.3.0
7
 # Release == build
7
 # Release == build
8
 # increase on changes of services files or tld_names.dat
8
 # increase on changes of services files or tld_names.dat
9
 PKG_RELEASE:=1
9
 PKG_RELEASE:=1
51
 define Package/$(PKG_NAME)_CloudFlare
51
 define Package/$(PKG_NAME)_CloudFlare
52
     $(call Package/$(PKG_NAME)/Default)
52
     $(call Package/$(PKG_NAME)/Default)
53
     TITLE:=DDNS extension for CloudFlare
53
     TITLE:=DDNS extension for CloudFlare
54
-    DEPENDS:=+$(PKG_NAME)
54
+    DEPENDS:=$(PKG_NAME)
55
 endef
55
 endef
56
 define Package/$(PKG_NAME)_CloudFlare/description
56
 define Package/$(PKG_NAME)_CloudFlare/description
57
     Dynamic DNS Client scripts extension for CloudFlare
57
     Dynamic DNS Client scripts extension for CloudFlare
60
 define Package/$(PKG_NAME)_No-IP_com
60
 define Package/$(PKG_NAME)_No-IP_com
61
     $(call Package/$(PKG_NAME)/Default)
61
     $(call Package/$(PKG_NAME)/Default)
62
     TITLE:=DDNS extension for No-IP.com
62
     TITLE:=DDNS extension for No-IP.com
63
-    DEPENDS:=+$(PKG_NAME)
63
+    DEPENDS:=$(PKG_NAME)
64
 endef
64
 endef
65
 define Package/$(PKG_NAME)_No-IP_com/description
65
 define Package/$(PKG_NAME)_No-IP_com/description
66
     Dynamic DNS Client scripts extension for No-IP.com
66
     Dynamic DNS Client scripts extension for No-IP.com

+ 1
- 0
net/ddns-scripts/files/ddns.init 查看文件

8
 
8
 
9
 reload() {
9
 reload() {
10
 	killall -1 dynamic_dns_updater.sh 2>/dev/null	# send SIGHUP
10
 	killall -1 dynamic_dns_updater.sh 2>/dev/null	# send SIGHUP
11
+	return 0
11
 }
12
 }
12
 
13
 
13
 restart() {
14
 restart() {

+ 23
- 14
net/ddns-scripts/files/dynamic_dns_functions.sh 查看文件

32
 SECTION_ID=""		# hold config's section name
32
 SECTION_ID=""		# hold config's section name
33
 VERBOSE_MODE=1		# default mode is log to console, but easily changed with parameter
33
 VERBOSE_MODE=1		# default mode is log to console, but easily changed with parameter
34
 
34
 
35
-			# allow NON-public IP's
36
-ALLOW_LOCAL_IP=$(uci -q get ddns.global.allow_local_ip) || ALLOW_LOCAL_IP=0
37
-			# directory to store run information to.
38
-RUNDIR=$(uci -q get ddns.global.run_dir) || RUNDIR="/var/run/ddns"
39
-[ -d $RUNDIR ] || mkdir -p -m755 $RUNDIR
40
-			# directory to store log files
41
-LOGDIR=$(uci -q get ddns.global.log_dir) || LOGDIR="/var/log/ddns"
42
-[ -d $LOGDIR ] || mkdir -p -m755 $LOGDIR
43
 LOGFILE=""		# logfile - all files are set in dynamic_dns_updater.sh
35
 LOGFILE=""		# logfile - all files are set in dynamic_dns_updater.sh
44
 PIDFILE=""		# pid file
36
 PIDFILE=""		# pid file
45
 UPDFILE=""		# store UPTIME of last update
37
 UPDFILE=""		# store UPTIME of last update
47
 ERRFILE=""		# save stderr output of WGet and other external programs called
39
 ERRFILE=""		# save stderr output of WGet and other external programs called
48
 TLDFILE=/usr/lib/ddns/tld_names.dat	# TLD file used by split_FQDN
40
 TLDFILE=/usr/lib/ddns/tld_names.dat	# TLD file used by split_FQDN
49
 
41
 
50
-			# number of lines to before rotate logfile
51
-LOGLINES=$(uci -q get ddns.global.log_lines) || LOGLINES=250
52
-LOGLINES=$((LOGLINES + 1))	# correct sed handling
53
-
54
 CHECK_SECONDS=0		# calculated seconds out of given
42
 CHECK_SECONDS=0		# calculated seconds out of given
55
 FORCE_SECONDS=0		# interval and unit
43
 FORCE_SECONDS=0		# interval and unit
56
 RETRY_SECONDS=0		# in configuration
44
 RETRY_SECONDS=0		# in configuration
71
 
59
 
72
 PID_SLEEP=0		# ProcessID of current background "sleep"
60
 PID_SLEEP=0		# ProcessID of current background "sleep"
73
 
61
 
62
+# allow NON-public IP's
63
+ALLOW_LOCAL_IP=$(uci -q get ddns.global.allow_local_ip) || ALLOW_LOCAL_IP=0
64
+
65
+# directory to store run information to.
66
+RUNDIR=$(uci -q get ddns.global.run_dir) || RUNDIR="/var/run/ddns"
67
+[ -d $RUNDIR ] || mkdir -p -m755 $RUNDIR
68
+
69
+# directory to store log files
70
+LOGDIR=$(uci -q get ddns.global.log_dir) || LOGDIR="/var/log/ddns"
71
+[ -d $LOGDIR ] || mkdir -p -m755 $LOGDIR
72
+
73
+# number of lines to before rotate logfile
74
+LOGLINES=$(uci -q get ddns.global.log_lines) || LOGLINES=250
75
+LOGLINES=$((LOGLINES + 1))	# correct sed handling
76
+
74
 # format to show date information in log and luci-app-ddns default ISO 8601 format
77
 # format to show date information in log and luci-app-ddns default ISO 8601 format
75
 DATE_FORMAT=$(uci -q get ddns.global.date_format) || DATE_FORMAT="%F %R"
78
 DATE_FORMAT=$(uci -q get ddns.global.date_format) || DATE_FORMAT="%F %R"
76
 DATE_PROG="date +'$DATE_FORMAT'"
79
 DATE_PROG="date +'$DATE_FORMAT'"
84
 # detect if called by dynamic_dns_lucihelper.sh script, disable retrys (empty variable == false)
87
 # detect if called by dynamic_dns_lucihelper.sh script, disable retrys (empty variable == false)
85
 [ "$(basename $0)" = "dynamic_dns_lucihelper.sh" ] && LUCI_HELPER="TRUE" || LUCI_HELPER=""
88
 [ "$(basename $0)" = "dynamic_dns_lucihelper.sh" ] && LUCI_HELPER="TRUE" || LUCI_HELPER=""
86
 
89
 
90
+# USE_CURL if GNU Wget and cURL installed normally Wget is used by do_transfer()
91
+# to change this use global option use_curl '1'
92
+USE_CURL=$(uci -q get ddns.global.use_curl) || USE_CURL=0	# read config
93
+[ -x /usr/bin/curl ] || USE_CURL=0				# check for cURL
94
+
87
 # loads all options for a given package and section
95
 # loads all options for a given package and section
88
 # also, sets all_option_variables to a list of the variable names
96
 # also, sets all_option_variables to a list of the variable names
89
 # $1 = ddns, $2 = SECTION_ID
97
 # $1 = ddns, $2 = SECTION_ID
510
 	[ $force_ipversion -ne 0 -a $use_ipv6 -ne 0 -o -z "$__IPV4" ] && __IP=$__IPV6 || __IP=$__IPV4
518
 	[ $force_ipversion -ne 0 -a $use_ipv6 -ne 0 -o -z "$__IPV4" ] && __IP=$__IPV6 || __IP=$__IPV4
511
 
519
 
512
 	if [ -n "$__NCEXT" ]; then	# BusyBox nc compiled with extensions (timeout support)
520
 	if [ -n "$__NCEXT" ]; then	# BusyBox nc compiled with extensions (timeout support)
513
-		__RUNPROG="/usr/bin/nc -vw 1 $__IP $__PORT </dev/null >$DATFILE 2>$ERRFILE"
521
+		__RUNPROG="/usr/bin/nc -w 1 $__IP $__PORT </dev/null >$DATFILE 2>$ERRFILE"
514
 		write_log 7 "#> $__RUNPROG"
522
 		write_log 7 "#> $__RUNPROG"
515
 		eval $__RUNPROG
523
 		eval $__RUNPROG
516
 		__ERR=$?
524
 		__ERR=$?
633
 	[ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters"
641
 	[ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters"
634
 
642
 
635
 	# lets prefer GNU Wget because it does all for us - IPv4/IPv6/HTTPS/PROXY/force IP version
643
 	# lets prefer GNU Wget because it does all for us - IPv4/IPv6/HTTPS/PROXY/force IP version
636
-	if /usr/bin/wget --version 2>&1 | grep "\+ssl" >/dev/null 2>&1 ; then
644
+	grep -i "\+ssl" /usr/bin/wget >/dev/null 2>&1	# check for Wget with SSL support
645
+	if [ $? -eq 0 -a $USE_CURL -eq 0 ]; then 	# except global option use_curl is set to "1"
637
 		__PROG="/usr/bin/wget -nv -t 1 -O $DATFILE -o $ERRFILE"	# non_verbose no_retry outfile errfile
646
 		__PROG="/usr/bin/wget -nv -t 1 -O $DATFILE -o $ERRFILE"	# non_verbose no_retry outfile errfile
638
 		# force network/ip to use for communication
647
 		# force network/ip to use for communication
639
 		if [ -n "$bind_network" ]; then
648
 		if [ -n "$bind_network" ]; then

+ 1
- 1
net/ddns-scripts/files/dynamic_dns_updater.sh 查看文件

201
 
201
 
202
 # kill old process if it exists & set new pid file
202
 # kill old process if it exists & set new pid file
203
 stop_section_processes "$SECTION_ID"
203
 stop_section_processes "$SECTION_ID"
204
-[ $? -gt 0 ] && write_log 7 "Send 'SIGTERM' was send to old process" || write_log 7 "No old process"
204
+[ $? -gt 0 ] && write_log 7 "'SIGTERM' was send to old process" || write_log 7 "No old process"
205
 echo $$ > $PIDFILE
205
 echo $$ > $PIDFILE
206
 
206
 
207
 # determine when the last update was
207
 # determine when the last update was