Browse Source

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>
lilik-openwrt-22.03
Christian Schoenebeck 10 years ago
parent
commit
5731d0e52d
4 changed files with 28 additions and 18 deletions
  1. +3
    -3
      net/ddns-scripts/Makefile
  2. +1
    -0
      net/ddns-scripts/files/ddns.init
  3. +23
    -14
      net/ddns-scripts/files/dynamic_dns_functions.sh
  4. +1
    -1
      net/ddns-scripts/files/dynamic_dns_updater.sh

+ 3
- 3
net/ddns-scripts/Makefile View File

@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ddns-scripts PKG_NAME:=ddns-scripts
# Version == major.minor.patch # Version == major.minor.patch
# increase on new functionality (minor) or patches (patch) # increase on new functionality (minor) or patches (patch)
PKG_VERSION:=2.2.0
PKG_VERSION:=2.3.0
# Release == build # Release == build
# increase on changes of services files or tld_names.dat # increase on changes of services files or tld_names.dat
PKG_RELEASE:=1 PKG_RELEASE:=1
@ -51,7 +51,7 @@ endef
define Package/$(PKG_NAME)_CloudFlare define Package/$(PKG_NAME)_CloudFlare
$(call Package/$(PKG_NAME)/Default) $(call Package/$(PKG_NAME)/Default)
TITLE:=DDNS extension for CloudFlare TITLE:=DDNS extension for CloudFlare
DEPENDS:=+$(PKG_NAME)
DEPENDS:=$(PKG_NAME)
endef endef
define Package/$(PKG_NAME)_CloudFlare/description define Package/$(PKG_NAME)_CloudFlare/description
Dynamic DNS Client scripts extension for CloudFlare Dynamic DNS Client scripts extension for CloudFlare
@ -60,7 +60,7 @@ endef
define Package/$(PKG_NAME)_No-IP_com define Package/$(PKG_NAME)_No-IP_com
$(call Package/$(PKG_NAME)/Default) $(call Package/$(PKG_NAME)/Default)
TITLE:=DDNS extension for No-IP.com TITLE:=DDNS extension for No-IP.com
DEPENDS:=+$(PKG_NAME)
DEPENDS:=$(PKG_NAME)
endef endef
define Package/$(PKG_NAME)_No-IP_com/description define Package/$(PKG_NAME)_No-IP_com/description
Dynamic DNS Client scripts extension for No-IP.com Dynamic DNS Client scripts extension for No-IP.com


+ 1
- 0
net/ddns-scripts/files/ddns.init View File

@ -8,6 +8,7 @@ boot() {
reload() { reload() {
killall -1 dynamic_dns_updater.sh 2>/dev/null # send SIGHUP killall -1 dynamic_dns_updater.sh 2>/dev/null # send SIGHUP
return 0
} }
restart() { restart() {


+ 23
- 14
net/ddns-scripts/files/dynamic_dns_functions.sh View File

@ -32,14 +32,6 @@
SECTION_ID="" # hold config's section name SECTION_ID="" # hold config's section name
VERBOSE_MODE=1 # default mode is log to console, but easily changed with parameter VERBOSE_MODE=1 # default mode is log to console, but easily changed with parameter
# allow NON-public IP's
ALLOW_LOCAL_IP=$(uci -q get ddns.global.allow_local_ip) || ALLOW_LOCAL_IP=0
# directory to store run information to.
RUNDIR=$(uci -q get ddns.global.run_dir) || RUNDIR="/var/run/ddns"
[ -d $RUNDIR ] || mkdir -p -m755 $RUNDIR
# directory to store log files
LOGDIR=$(uci -q get ddns.global.log_dir) || LOGDIR="/var/log/ddns"
[ -d $LOGDIR ] || mkdir -p -m755 $LOGDIR
LOGFILE="" # logfile - all files are set in dynamic_dns_updater.sh LOGFILE="" # logfile - all files are set in dynamic_dns_updater.sh
PIDFILE="" # pid file PIDFILE="" # pid file
UPDFILE="" # store UPTIME of last update UPDFILE="" # store UPTIME of last update
@ -47,10 +39,6 @@ DATFILE="" # save stdout data of WGet and other external programs called
ERRFILE="" # save stderr output of WGet and other external programs called ERRFILE="" # save stderr output of WGet and other external programs called
TLDFILE=/usr/lib/ddns/tld_names.dat # TLD file used by split_FQDN TLDFILE=/usr/lib/ddns/tld_names.dat # TLD file used by split_FQDN
# number of lines to before rotate logfile
LOGLINES=$(uci -q get ddns.global.log_lines) || LOGLINES=250
LOGLINES=$((LOGLINES + 1)) # correct sed handling
CHECK_SECONDS=0 # calculated seconds out of given CHECK_SECONDS=0 # calculated seconds out of given
FORCE_SECONDS=0 # interval and unit FORCE_SECONDS=0 # interval and unit
RETRY_SECONDS=0 # in configuration RETRY_SECONDS=0 # in configuration
@ -71,6 +59,21 @@ ERR_UPDATE=0 # error counter on different local and registered ip
PID_SLEEP=0 # ProcessID of current background "sleep" PID_SLEEP=0 # ProcessID of current background "sleep"
# allow NON-public IP's
ALLOW_LOCAL_IP=$(uci -q get ddns.global.allow_local_ip) || ALLOW_LOCAL_IP=0
# directory to store run information to.
RUNDIR=$(uci -q get ddns.global.run_dir) || RUNDIR="/var/run/ddns"
[ -d $RUNDIR ] || mkdir -p -m755 $RUNDIR
# directory to store log files
LOGDIR=$(uci -q get ddns.global.log_dir) || LOGDIR="/var/log/ddns"
[ -d $LOGDIR ] || mkdir -p -m755 $LOGDIR
# number of lines to before rotate logfile
LOGLINES=$(uci -q get ddns.global.log_lines) || LOGLINES=250
LOGLINES=$((LOGLINES + 1)) # correct sed handling
# format to show date information in log and luci-app-ddns default ISO 8601 format # format to show date information in log and luci-app-ddns default ISO 8601 format
DATE_FORMAT=$(uci -q get ddns.global.date_format) || DATE_FORMAT="%F %R" DATE_FORMAT=$(uci -q get ddns.global.date_format) || DATE_FORMAT="%F %R"
DATE_PROG="date +'$DATE_FORMAT'" DATE_PROG="date +'$DATE_FORMAT'"
@ -84,6 +87,11 @@ IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(
# detect if called by dynamic_dns_lucihelper.sh script, disable retrys (empty variable == false) # detect if called by dynamic_dns_lucihelper.sh script, disable retrys (empty variable == false)
[ "$(basename $0)" = "dynamic_dns_lucihelper.sh" ] && LUCI_HELPER="TRUE" || LUCI_HELPER="" [ "$(basename $0)" = "dynamic_dns_lucihelper.sh" ] && LUCI_HELPER="TRUE" || LUCI_HELPER=""
# USE_CURL if GNU Wget and cURL installed normally Wget is used by do_transfer()
# to change this use global option use_curl '1'
USE_CURL=$(uci -q get ddns.global.use_curl) || USE_CURL=0 # read config
[ -x /usr/bin/curl ] || USE_CURL=0 # check for cURL
# loads all options for a given package and section # loads all options for a given package and section
# also, sets all_option_variables to a list of the variable names # also, sets all_option_variables to a list of the variable names
# $1 = ddns, $2 = SECTION_ID # $1 = ddns, $2 = SECTION_ID
@ -510,7 +518,7 @@ verify_host_port() {
[ $force_ipversion -ne 0 -a $use_ipv6 -ne 0 -o -z "$__IPV4" ] && __IP=$__IPV6 || __IP=$__IPV4 [ $force_ipversion -ne 0 -a $use_ipv6 -ne 0 -o -z "$__IPV4" ] && __IP=$__IPV6 || __IP=$__IPV4
if [ -n "$__NCEXT" ]; then # BusyBox nc compiled with extensions (timeout support) if [ -n "$__NCEXT" ]; then # BusyBox nc compiled with extensions (timeout support)
__RUNPROG="/usr/bin/nc -vw 1 $__IP $__PORT </dev/null >$DATFILE 2>$ERRFILE"
__RUNPROG="/usr/bin/nc -w 1 $__IP $__PORT </dev/null >$DATFILE 2>$ERRFILE"
write_log 7 "#> $__RUNPROG" write_log 7 "#> $__RUNPROG"
eval $__RUNPROG eval $__RUNPROG
__ERR=$? __ERR=$?
@ -633,7 +641,8 @@ do_transfer() {
[ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters" [ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters"
# lets prefer GNU Wget because it does all for us - IPv4/IPv6/HTTPS/PROXY/force IP version # lets prefer GNU Wget because it does all for us - IPv4/IPv6/HTTPS/PROXY/force IP version
if /usr/bin/wget --version 2>&1 | grep "\+ssl" >/dev/null 2>&1 ; then
grep -i "\+ssl" /usr/bin/wget >/dev/null 2>&1 # check for Wget with SSL support
if [ $? -eq 0 -a $USE_CURL -eq 0 ]; then # except global option use_curl is set to "1"
__PROG="/usr/bin/wget -nv -t 1 -O $DATFILE -o $ERRFILE" # non_verbose no_retry outfile errfile __PROG="/usr/bin/wget -nv -t 1 -O $DATFILE -o $ERRFILE" # non_verbose no_retry outfile errfile
# force network/ip to use for communication # force network/ip to use for communication
if [ -n "$bind_network" ]; then if [ -n "$bind_network" ]; then


+ 1
- 1
net/ddns-scripts/files/dynamic_dns_updater.sh View File

@ -201,7 +201,7 @@ write_log 7 "retry counter : $retry_count times"
# kill old process if it exists & set new pid file # kill old process if it exists & set new pid file
stop_section_processes "$SECTION_ID" stop_section_processes "$SECTION_ID"
[ $? -gt 0 ] && write_log 7 "Send 'SIGTERM' was send to old process" || write_log 7 "No old process"
[ $? -gt 0 ] && write_log 7 "'SIGTERM' was send to old process" || write_log 7 "No old process"
echo $$ > $PIDFILE echo $$ > $PIDFILE
# determine when the last update was # determine when the last update was


Loading…
Cancel
Save