ddns-scripts: bump to version 2.7.8-1
- remove Cloudflare v1 protocol support #6084 #6519 - fix goip.de update url #6448 #6519 - change Cloudflare v4 to read "Proxied" from current setting at Cloudflare Dashboard #5097 #6364 #6505 - fix replace of password inside logfile #6568 - remove myself as PKG_MAINTAINER Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
This commit is contained in:
parent
d0bac09ae5
commit
a6551b2cbc
13 changed files with 39 additions and 12706 deletions
|
@ -9,13 +9,13 @@ 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.7.7
|
PKG_VERSION:=2.7.8
|
||||||
# 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:=8
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
PKG_MAINTAINER:=
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
@ -53,16 +53,6 @@ define Package/ddns-scripts/config
|
||||||
Info : http://wiki.openwrt.org/doc/howto/ddns.client
|
Info : http://wiki.openwrt.org/doc/howto/ddns.client
|
||||||
endef
|
endef
|
||||||
|
|
||||||
###### *************************************************************************
|
|
||||||
define Package/ddns-scripts_cloudflare
|
|
||||||
$(call Package/ddns-scripts/Default)
|
|
||||||
TITLE:=CloudFlare.com API v1 (deprecated)
|
|
||||||
DEPENDS:=ddns-scripts
|
|
||||||
endef
|
|
||||||
define Package/ddns-scripts_cloudflare/description
|
|
||||||
Dynamic DNS Client scripts extension for CloudFlare.com API-v1 (deprecated)
|
|
||||||
endef
|
|
||||||
|
|
||||||
###### *************************************************************************
|
###### *************************************************************************
|
||||||
define Package/ddns-scripts_cloudflare.com-v4
|
define Package/ddns-scripts_cloudflare.com-v4
|
||||||
$(call Package/ddns-scripts/Default)
|
$(call Package/ddns-scripts/Default)
|
||||||
|
@ -153,8 +143,6 @@ define Build/Compile
|
||||||
-e '/^\/\/[[:space:]]/d' \
|
-e '/^\/\/[[:space:]]/d' \
|
||||||
-e '/^[[:space:]]*$$$$/d' $$$$FILE; \
|
-e '/^[[:space:]]*$$$$/d' $$$$FILE; \
|
||||||
done
|
done
|
||||||
# compress public_suffix_list.dat
|
|
||||||
gzip -nf9 $(PKG_BUILD_DIR)/files/public_suffix_list.dat
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/ddns-scripts/conffiles
|
define Package/ddns-scripts/conffiles
|
||||||
|
@ -208,49 +196,6 @@ define Package/ddns-scripts/prerm
|
||||||
exit 0 # suppress errors
|
exit 0 # suppress errors
|
||||||
endef
|
endef
|
||||||
|
|
||||||
###### *************************************************************************
|
|
||||||
define Package/ddns-scripts_cloudflare/preinst
|
|
||||||
#!/bin/sh
|
|
||||||
# if NOT run buildroot then stop service
|
|
||||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
|
||||||
exit 0 # suppress errors
|
|
||||||
endef
|
|
||||||
define Package/ddns-scripts_cloudflare/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare
|
|
||||||
$(INSTALL_DIR) $(1)/usr/share
|
|
||||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz $(1)/usr/share
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v1.sh $(1)/usr/lib/ddns
|
|
||||||
endef
|
|
||||||
define Package/ddns-scripts_cloudflare/postinst
|
|
||||||
#!/bin/sh
|
|
||||||
# remove old services file entries
|
|
||||||
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
|
||||||
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
|
||||||
# and create new
|
|
||||||
printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
|
||||||
printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
|
||||||
# on real system restart service if enabled
|
|
||||||
[ -z "$${IPKG_INSTROOT}" ] && {
|
|
||||||
[ -x /etc/uci-defaults/ddns_cloudflare ] && \
|
|
||||||
/etc/uci-defaults/ddns_cloudflare && \
|
|
||||||
rm -f /etc/uci-defaults/ddns_cloudflare >/dev/null 2>&1
|
|
||||||
/etc/init.d/ddns enabled && \
|
|
||||||
/etc/init.d/ddns start >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
exit 0 # suppress errors
|
|
||||||
endef
|
|
||||||
define Package/ddns-scripts_cloudflare/prerm
|
|
||||||
#!/bin/sh
|
|
||||||
# if NOT run buildroot then stop service
|
|
||||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
|
||||||
# remove services file entries
|
|
||||||
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
|
||||||
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
|
||||||
exit 0 # suppress errors
|
|
||||||
endef
|
|
||||||
|
|
||||||
###### *************************************************************************
|
###### *************************************************************************
|
||||||
define Package/ddns-scripts_cloudflare.com-v4/preinst
|
define Package/ddns-scripts_cloudflare.com-v4/preinst
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
@ -493,7 +438,6 @@ endef
|
||||||
|
|
||||||
###### *************************************************************************
|
###### *************************************************************************
|
||||||
$(eval $(call BuildPackage,ddns-scripts))
|
$(eval $(call BuildPackage,ddns-scripts))
|
||||||
$(eval $(call BuildPackage,ddns-scripts_cloudflare))
|
|
||||||
$(eval $(call BuildPackage,ddns-scripts_cloudflare.com-v4))
|
$(eval $(call BuildPackage,ddns-scripts_cloudflare.com-v4))
|
||||||
$(eval $(call BuildPackage,ddns-scripts_freedns_42_pl))
|
$(eval $(call BuildPackage,ddns-scripts_freedns_42_pl))
|
||||||
$(eval $(call BuildPackage,ddns-scripts_godaddy.com-v1))
|
$(eval $(call BuildPackage,ddns-scripts_godaddy.com-v1))
|
||||||
|
|
|
@ -6,77 +6,6 @@ g_pslfile=/usr/share/public_suffix_list.dat.gz
|
||||||
g_pslerr=0
|
g_pslerr=0
|
||||||
g_cfgfile="ddns"
|
g_cfgfile="ddns"
|
||||||
|
|
||||||
# modify "cloudflare.com-v1" domain to new syntax
|
|
||||||
# returns "host[.subdom]@domain.TLD" of given FQDN #############################
|
|
||||||
mod_cloudflare_v1_domain() {
|
|
||||||
# $1 entry to validate/split
|
|
||||||
[ -f "$g_pslfile" ] || return 1
|
|
||||||
|
|
||||||
[ $# -ne 1 -o -z "$1" ] && \
|
|
||||||
{ printf "%s\\n" "mod_cloudflare_v1_domain() - Invalid number of parameters" >&2; return 1; }
|
|
||||||
|
|
||||||
local mcd_fqdn=$1
|
|
||||||
local mcd_fsub=""
|
|
||||||
local mcd_fdom=""
|
|
||||||
local mcd_ctld=""
|
|
||||||
local mcd_ftld=""
|
|
||||||
|
|
||||||
# check if already new syntax, "@" inside string
|
|
||||||
if [ $( printf "%s" "$mcd_fqdn" | grep -cF "@" 2>/dev/null ) -gt 0 ]; then
|
|
||||||
# already done
|
|
||||||
printf "%s" "$mcd_fqdn"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# we need to do in one line because otherwise sh doesn't work correctly
|
|
||||||
# to lower | replace "." to " " | awk invert word order
|
|
||||||
set -- $(printf %s "$mcd_fqdn" | tr [A-Z] [a-z] | tr "." " " \
|
|
||||||
| awk '{do printf "%s"(NF>1?OFS:ORS),$NF;while (--NF)}' )
|
|
||||||
|
|
||||||
while [ -n "${1:-}" ] ; do # as long we have parameters
|
|
||||||
if [ -z "$mcd_ctld" ]; then # first loop
|
|
||||||
mcd_ctld="$1" # CURRENT TLD to look at
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
mcd_ctld="$1.$mcd_ctld" # Next TLD to look at
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
# check if TLD exact match in public_suffix_name.dat, save TLD
|
|
||||||
zcat $g_pslfile | grep -E "^$mcd_ctld$" >/dev/null 2>&1 && {
|
|
||||||
mcd_ftld="$mcd_ctld" # save found
|
|
||||||
mcd_fdom="${1:-}" # save domain next step might be invalid
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
# check if match any "*" in public_suffix_name.dat,
|
|
||||||
zcat $g_pslfile | grep -E "^\*.$mcd_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 $g_pslfile | grep -E "^!$1.$mcd_ctld$" >/dev/null 2>&1 ; then
|
|
||||||
mcd_ftld="$mcd_ctld" # Yes
|
|
||||||
else
|
|
||||||
mcd_ftld="$1.$mcd_ctld"
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
mcd_fdom="$1"; shift
|
|
||||||
}
|
|
||||||
[ -n "$mcd_ftld" ] && break # we have something valid, break
|
|
||||||
done
|
|
||||||
|
|
||||||
# the leftover parameters are the HOST/SUBDOMAIN
|
|
||||||
while [ -n "${1:-}" ]; do
|
|
||||||
mcd_fsub="${1}${mcd_fsub:+.$mcd_fsub}" # remember we need to invert
|
|
||||||
shift # and insert dot if mcd_fsub not empty
|
|
||||||
done
|
|
||||||
|
|
||||||
# now validate found data
|
|
||||||
[ -z "$mcd_ftld" ] && { printf "%s\\n" "mod_cloudflare_v1_domain() - no TLD not found in '$mcd_fqdn'" >&1; return 1; }
|
|
||||||
[ -z "$mcd_fdom" ] && { printf "%s\\n" "mod_cloudflare_v1_domain() - no registrable Domain not found in '$mcd_fqdn'" >&1; return 1; }
|
|
||||||
|
|
||||||
# return data
|
|
||||||
printf "%s" "${mcd_fsub:+${mcd_fsub}@}${mcd_fdom}.${mcd_ftld}"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# modify timer settings from interval and unit to dhms format
|
# modify timer settings from interval and unit to dhms format
|
||||||
timer2dhms() {
|
timer2dhms() {
|
||||||
# $1 Number and
|
# $1 Number and
|
||||||
|
@ -144,36 +73,6 @@ update_config() {
|
||||||
$uc_uci set $g_cfgfile.$uc_name.$uc_var="afraid.org-keyauth";;
|
$uc_uci set $g_cfgfile.$uc_name.$uc_var="afraid.org-keyauth";;
|
||||||
Bind-nsupdate)
|
Bind-nsupdate)
|
||||||
$uc_uci set $g_cfgfile.$uc_name.$uc_var="bind-nsupdate";;
|
$uc_uci set $g_cfgfile.$uc_name.$uc_var="bind-nsupdate";;
|
||||||
CloudFlare|cloudflare\.com|cloudflare\.com-v1)
|
|
||||||
# verify if lookup_host is set
|
|
||||||
$uc_uci get $g_cfgfile.$uc_name.lookup_host >/dev/null 2>&1 || {
|
|
||||||
ucv_domain=$($uc_uci get $g_cfgfile.$uc_name.domain 2>/dev/null)
|
|
||||||
$uc_uci set $g_cfgfile.$uc_name.lookup_host="$ucv_domain"
|
|
||||||
}
|
|
||||||
if [ -f "$g_pslfile" ]; then
|
|
||||||
# change value of domain/upd_object to new syntax
|
|
||||||
# there is no sort order inside uci data so we need multiple checks
|
|
||||||
ucv_domain=$($uc_uci get $g_cfgfile.$uc_name.domain 2>/dev/null)
|
|
||||||
ucv_object=$($uc_uci get $g_cfgfile.$uc_name.upd_object 2>/dev/null)
|
|
||||||
# still old option domain
|
|
||||||
if [ -n "$ucv_domain" ]; then
|
|
||||||
ucv_new=$(mod_cloudflare_v1_domain "$ucv_domain") || g_pslerr=1
|
|
||||||
# no error save data save data
|
|
||||||
[ $g_pslerr -eq 0 ] && \
|
|
||||||
$uc_uci set $g_cfgfile.$uc_name.domain="$ucv_new"
|
|
||||||
fi
|
|
||||||
# already new option upd_object
|
|
||||||
if [ -n "$ucv_object" ]; then
|
|
||||||
ucv_new=$(mod_cloudflare_v1_domain "$ucv_object") || g_pslerr=1
|
|
||||||
# no error save data save data
|
|
||||||
[ $g_pslerr -eq 0 ] && \
|
|
||||||
$uc_uci set $g_cfgfile.$uc_name.upd_object="$ucv_new"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
unset ucv_domain ucv_object ucv_new
|
|
||||||
# set new option value
|
|
||||||
$uc_uci set $g_cfgfile.$uc_name.$uc_var="cloudflare.com-v1"
|
|
||||||
;;
|
|
||||||
dyndns\.org|dyndns\.com)
|
dyndns\.org|dyndns\.com)
|
||||||
$uc_uci set $g_cfgfile.$uc_name.$uc_var="dyn.com";;
|
$uc_uci set $g_cfgfile.$uc_name.$uc_var="dyn.com";;
|
||||||
free\.editdns\.net)
|
free\.editdns\.net)
|
||||||
|
@ -206,15 +105,6 @@ update_config() {
|
||||||
# there is no sort order inside uci data so we need multiple checks
|
# there is no sort order inside uci data so we need multiple checks
|
||||||
uco_provider=$($uc_uci get $g_cfgfile.$uc_name.upd_provider 2>/dev/null) || \
|
uco_provider=$($uc_uci get $g_cfgfile.$uc_name.upd_provider 2>/dev/null) || \
|
||||||
uco_provider=$($uc_uci get $g_cfgfile.$uc_name.service_name 2>/dev/null)
|
uco_provider=$($uc_uci get $g_cfgfile.$uc_name.service_name 2>/dev/null)
|
||||||
if [ "$uco_provider" = "CloudFlare" \
|
|
||||||
-o "$uco_provider" = "cloudflare.com" \
|
|
||||||
-o "$uco_provider" = "cloudflare.com-v1" ]; then
|
|
||||||
ucv_new=$(mod_cloudflare_v1_domain "$uc_val") || g_pslerr=1
|
|
||||||
# no error save data save data
|
|
||||||
[ $g_pslerr -eq 0 ] && \
|
|
||||||
$uc_uci set $g_cfgfile.$uc_name.$uc_var="$ucv_new"
|
|
||||||
unset ucv_new
|
|
||||||
fi
|
|
||||||
unset uco_provider
|
unset uco_provider
|
||||||
fi
|
fi
|
||||||
# rename option domain to option upd_object
|
# rename option domain to option upd_object
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
# GLOBAL VARIABLES #
|
# GLOBAL VARIABLES #
|
||||||
VERSION="2.7.7-2"
|
VERSION="2.7.8-1"
|
||||||
SECTION_ID="" # hold config's section name
|
SECTION_ID="" # hold config's section name
|
||||||
VERBOSE=0 # default mode is log to console, but easily changed with parameter
|
VERBOSE=0 # default mode is log to console, but easily changed with parameter
|
||||||
MYPROG=$(basename $0) # my program call name
|
MYPROG=$(basename $0) # my program call name
|
||||||
|
@ -224,7 +224,7 @@ stop_daemon_for_all_ddns_sections() {
|
||||||
# value +10 will exit the scripts
|
# value +10 will exit the scripts
|
||||||
# $2..n text to report
|
# $2..n text to report
|
||||||
write_log() {
|
write_log() {
|
||||||
local __LEVEL __EXIT __CMD __MSG
|
local __LEVEL __EXIT __CMD __MSG __MSE
|
||||||
local __TIME=$(date +%H%M%S)
|
local __TIME=$(date +%H%M%S)
|
||||||
[ $1 -ge 10 ] && {
|
[ $1 -ge 10 ] && {
|
||||||
__LEVEL=$(($1-10))
|
__LEVEL=$(($1-10))
|
||||||
|
@ -258,8 +258,15 @@ write_log() {
|
||||||
[ $VERBOSE -gt 0 -o $__EXIT -gt 0 ] && echo -e "$__MSG"
|
[ $VERBOSE -gt 0 -o $__EXIT -gt 0 ] && echo -e "$__MSG"
|
||||||
# write to logfile
|
# write to logfile
|
||||||
if [ ${use_logfile:-1} -eq 1 -o $VERBOSE -gt 1 ]; then
|
if [ ${use_logfile:-1} -eq 1 -o $VERBOSE -gt 1 ]; then
|
||||||
[ -n "$password" ] && __MSG=$( printf "%s" "$__MSG" | sed -e "s/$password/*password*/g" )
|
if [ -n "$password" ]; then
|
||||||
[ -n "$URL_PASS" ] && __MSG=$( printf "%s" "$__MSG" | sed -e "s/$URL_PASS/*URL_PASS*/g" )
|
# url encode __MSG, password already done
|
||||||
|
urlencode __MSE "$__MSG"
|
||||||
|
# replace encoded password inside encoded message
|
||||||
|
# and url decode (newline was encoded as %00)
|
||||||
|
__MSG=$( echo -e "$__MSE" \
|
||||||
|
| sed -e "s/$URL_PASS/***PW***/g" \
|
||||||
|
| sed -e "s/+/ /g; s/%00/\n/g; s/%/\\\\x/g" | xargs -0 printf "%b" )
|
||||||
|
fi
|
||||||
printf "%s\n" "$__MSG" >> $LOGFILE
|
printf "%s\n" "$__MSG" >> $LOGFILE
|
||||||
# VERBOSE > 1 then NO loop so NO truncate log to $ddns_loglines lines
|
# VERBOSE > 1 then NO loop so NO truncate log to $ddns_loglines lines
|
||||||
[ $VERBOSE -gt 1 ] || sed -i -e :a -e '$q;N;'$ddns_loglines',$D;ba' $LOGFILE
|
[ $VERBOSE -gt 1 ] || sed -i -e :a -e '$q;N;'$ddns_loglines',$D;ba' $LOGFILE
|
||||||
|
@ -877,7 +884,7 @@ send_update() {
|
||||||
|
|
||||||
do_transfer "$__URL" || return 1
|
do_transfer "$__URL" || return 1
|
||||||
|
|
||||||
write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)"
|
write_log 7 "DDNS Provider answered:${N}$(cat $DATFILE)"
|
||||||
|
|
||||||
[ -z "$UPD_ANSWER" ] && return 0 # not set then ignore
|
[ -z "$UPD_ANSWER" ] && return 0 # not set then ignore
|
||||||
|
|
||||||
|
@ -1197,17 +1204,17 @@ trap_handler() {
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
0) if [ $__ERR -eq 0 ]; then
|
0) if [ $__ERR -eq 0 ]; then
|
||||||
write_log 5 "PID '$$' exit normal at $(eval $DATE_PROG)\n"
|
write_log 5 "PID '$$' exit normal at $(eval $DATE_PROG)${N}"
|
||||||
else
|
else
|
||||||
write_log 4 "PID '$$' exit WITH ERROR '$__ERR' at $(eval $DATE_PROG)\n"
|
write_log 4 "PID '$$' exit WITH ERROR '$__ERR' at $(eval $DATE_PROG)${N}"
|
||||||
fi ;;
|
fi ;;
|
||||||
1) write_log 6 "PID '$$' received 'SIGHUP' at $(eval $DATE_PROG)"
|
1) write_log 6 "PID '$$' received 'SIGHUP' at $(eval $DATE_PROG)"
|
||||||
# reload config via starting the script again
|
# reload config via starting the script again
|
||||||
/usr/lib/ddns/dynamic_dns_updater.sh -v "0" -S "$__SECTIONID" -- start || true
|
/usr/lib/ddns/dynamic_dns_updater.sh -v "0" -S "$__SECTIONID" -- start || true
|
||||||
exit 0 ;; # and leave this one
|
exit 0 ;; # and leave this one
|
||||||
2) write_log 5 "PID '$$' terminated by 'SIGINT' at $(eval $DATE_PROG)\n";;
|
2) write_log 5 "PID '$$' terminated by 'SIGINT' at $(eval $DATE_PROG)${N}";;
|
||||||
3) write_log 5 "PID '$$' terminated by 'SIGQUIT' at $(eval $DATE_PROG)\n";;
|
3) write_log 5 "PID '$$' terminated by 'SIGQUIT' at $(eval $DATE_PROG)${N}";;
|
||||||
15) write_log 5 "PID '$$' terminated by 'SIGTERM' at $(eval $DATE_PROG)\n";;
|
15) write_log 5 "PID '$$' terminated by 'SIGTERM' at $(eval $DATE_PROG)${N}";;
|
||||||
*) write_log 13 "Unhandled signal '$1' in 'trap_handler()'";;
|
*) write_log 13 "Unhandled signal '$1' in 'trap_handler()'";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,13 @@ ERR_LAST=$? # save return code - equal 0 if SECTION_ID found
|
||||||
[ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 1 ] && ip_url="http://checkipv6.dyndns.com"
|
[ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 1 ] && ip_url="http://checkipv6.dyndns.com"
|
||||||
[ "$ip_source" = "interface" -a -z "$ip_interface" ] && ip_interface="eth1"
|
[ "$ip_source" = "interface" -a -z "$ip_interface" ] && ip_interface="eth1"
|
||||||
|
|
||||||
|
# url encode username (might be email or something like this)
|
||||||
|
# and password (might have special chars for security reason)
|
||||||
|
# and optional parameter "param_enc"
|
||||||
|
[ -n "$username" ] && urlencode URL_USER "$username"
|
||||||
|
[ -n "$password" ] && urlencode URL_PASS "$password"
|
||||||
|
[ -n "$param_enc" ] && urlencode URL_PENC "$param_enc"
|
||||||
|
|
||||||
# SECTION_ID does not exists
|
# SECTION_ID does not exists
|
||||||
[ $ERR_LAST -ne 0 ] && {
|
[ $ERR_LAST -ne 0 ] && {
|
||||||
[ $VERBOSE -le 1 ] && VERBOSE=2 # force console out and logfile output
|
[ $VERBOSE -le 1 ] && VERBOSE=2 # force console out and logfile output
|
||||||
|
@ -202,14 +209,14 @@ ERR_LAST=$? # save return code - equal 0 if SECTION_ID found
|
||||||
write_log 7 "************ ************** ************** **************"
|
write_log 7 "************ ************** ************** **************"
|
||||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||||
write_log 7 "ddns version : $VERSION"
|
write_log 7 "ddns version : $VERSION"
|
||||||
write_log 7 "uci configuration:\n$(uci -q show ddns | grep '=service' | sort)"
|
write_log 7 "uci configuration:${N}$(uci -q show ddns | grep '=service' | sort)"
|
||||||
write_log 14 "Service section '$SECTION_ID' not defined"
|
write_log 14 "Service section '$SECTION_ID' not defined"
|
||||||
}
|
}
|
||||||
|
|
||||||
write_log 7 "************ ************** ************** **************"
|
write_log 7 "************ ************** ************** **************"
|
||||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||||
write_log 7 "ddns version : $VERSION"
|
write_log 7 "ddns version : $VERSION"
|
||||||
write_log 7 "uci configuration:\n$(uci -q show ddns.$SECTION_ID | sort)"
|
write_log 7 "uci configuration:${N}$(uci -q show ddns.$SECTION_ID | sort)"
|
||||||
# write_log 7 "ddns version : $(opkg list-installed ddns-scripts | cut -d ' ' -f 3)"
|
# write_log 7 "ddns version : $(opkg list-installed ddns-scripts | cut -d ' ' -f 3)"
|
||||||
case $VERBOSE in
|
case $VERBOSE in
|
||||||
0) write_log 7 "verbose mode : 0 - run normal, NO console output";;
|
0) write_log 7 "verbose mode : 0 - run normal, NO console output";;
|
||||||
|
@ -254,13 +261,6 @@ esac
|
||||||
write_log 14 "Service section not configured correctly! Missing 'param_opt'"
|
write_log 14 "Service section not configured correctly! Missing 'param_opt'"
|
||||||
}
|
}
|
||||||
|
|
||||||
# url encode username (might be email or something like this)
|
|
||||||
# and password (might have special chars for security reason)
|
|
||||||
# and optional parameter "param_enc"
|
|
||||||
[ -n "$username" ] && urlencode URL_USER "$username"
|
|
||||||
[ -n "$password" ] && urlencode URL_PASS "$password"
|
|
||||||
[ -n "$param_enc" ] && urlencode URL_PENC "$param_enc"
|
|
||||||
|
|
||||||
# verify ip_source 'script' if script is configured and executable
|
# verify ip_source 'script' if script is configured and executable
|
||||||
if [ "$ip_source" = "script" ]; then
|
if [ "$ip_source" = "script" ]; then
|
||||||
set -- $ip_script #handling script with parameters, we need a trick
|
set -- $ip_script #handling script with parameters, we need a trick
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,6 @@
|
||||||
#
|
#
|
||||||
# 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
|
# 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||||
#
|
#
|
||||||
#.cloudflare.com-v1 !!! Please install additional package "ddns-scripts_cloudflare"
|
|
||||||
#.cloudflare.com-v4 !!! Please install additional package "ddns-scripts_cloudflare.com-v4"
|
#.cloudflare.com-v4 !!! Please install additional package "ddns-scripts_cloudflare.com-v4"
|
||||||
#.FreeDNS.42.pl !!! Please install additional package "ddns-scripts_freedns_42_pl"
|
#.FreeDNS.42.pl !!! Please install additional package "ddns-scripts_freedns_42_pl"
|
||||||
#.godaddy.com-v1 !!! Please install additional package "ddns-scripts_godaddy.com-v1"
|
#.godaddy.com-v1 !!! Please install additional package "ddns-scripts_godaddy.com-v1"
|
||||||
|
@ -113,7 +112,7 @@
|
||||||
|
|
||||||
"editdns.net" "http://dyndns-free.editdns.net/api/dynLinux.php?p=[PASSWORD]&r=[DOMAIN]"
|
"editdns.net" "http://dyndns-free.editdns.net/api/dynLinux.php?p=[PASSWORD]&r=[DOMAIN]"
|
||||||
|
|
||||||
"goip.de" "http://www.goip.de/setip?username=[USERNAME]&password=[PASSWORD]&subdomain=[DOMAIN]&ip4=[IP]"
|
"goip.de" "http://www.goip.de/setip?username=[USERNAME]&password=[PASSWORD]&subdomain=[DOMAIN]&ip=[IP]"
|
||||||
|
|
||||||
"google.com" "http://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
"google.com" "http://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#
|
#
|
||||||
# 66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
|
# 66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||||
#
|
#
|
||||||
#.cloudflare.com-v1 !!! Please install additional package "ddns-scripts_cloudflare"
|
|
||||||
#.cloudflare.com-v4 !!! Please install additional package "ddns-scripts_cloudflare.com-v4"
|
#.cloudflare.com-v4 !!! Please install additional package "ddns-scripts_cloudflare.com-v4"
|
||||||
#.godaddy.com-v1 !!! Please install additional package "ddns-scripts_godaddy.com-v1"
|
#.godaddy.com-v1 !!! Please install additional package "ddns-scripts_godaddy.com-v1"
|
||||||
#.no-ip.com / noip.com !!! Please install additional package "ddns-scripts_no-ip_com"
|
#.no-ip.com / noip.com !!! Please install additional package "ddns-scripts_no-ip_com"
|
||||||
|
|
|
@ -1,155 +0,0 @@
|
||||||
#
|
|
||||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
|
||||||
#
|
|
||||||
# script for sending updates to cloudflare.com
|
|
||||||
#.2014-2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
|
||||||
# many thanks to Paul for testing and feedback during development
|
|
||||||
#
|
|
||||||
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
|
||||||
#
|
|
||||||
# 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 - your full hostname to update, in cloudflare its subdomain.domain
|
|
||||||
# i.e. myhost.example.com where myhost is the subdomain and example.com is your domain
|
|
||||||
#
|
|
||||||
# variable __IP already defined with the ip-address to use for update
|
|
||||||
#
|
|
||||||
[ $use_https -eq 0 ] && write_log 14 "Cloudflare only support updates via Secure HTTP (HTTPS). Please correct configuration!"
|
|
||||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
|
||||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
|
||||||
|
|
||||||
local __RECID __URL __KEY __KEYS __FOUND __SUBDOM __DOMAIN __FQDN
|
|
||||||
|
|
||||||
# split __SUBDOM __DOMAIN from $domain
|
|
||||||
# given data:
|
|
||||||
# @example.com for "domain record"
|
|
||||||
# host.sub@example.com for a "host record"
|
|
||||||
__SUBDOM=$(printf %s "$domain" | cut -d@ -f1)
|
|
||||||
__DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
|
|
||||||
|
|
||||||
# Cloudflare v1 needs:
|
|
||||||
# __DOMAIN = the base domain i.e. example.com
|
|
||||||
# __SUBDOM = the host.sub to change if a "host record" or blank if domain record
|
|
||||||
# __FQDN = the FQDN to detect record_id to change
|
|
||||||
# i.e. example.com for the "domain record" or host.sub.example.com for "host record"
|
|
||||||
if [ -z "$__SUBDOM" -o "$__SUBDOM" = "$__DOMAIN" ]; then
|
|
||||||
__SUBDOM=""
|
|
||||||
__FQDN="$__DOMAIN"
|
|
||||||
else
|
|
||||||
__FQDN="${__SUBDOM}.${__DOMAIN}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# parse OpenWrt script with
|
|
||||||
# functions for parsing and generating json
|
|
||||||
. /usr/share/libubox/jshn.sh
|
|
||||||
|
|
||||||
# function copied from /usr/share/libubox/jshn.sh
|
|
||||||
# from BB14.09 for backward compatibility to AA12.09
|
|
||||||
type "json_get_keys" >/dev/null 2>&1 || json_get_keys() {
|
|
||||||
local __dest="$1"
|
|
||||||
local _tbl_cur
|
|
||||||
|
|
||||||
if [ -n "$2" ]; then
|
|
||||||
json_get_var _tbl_cur "$2"
|
|
||||||
else
|
|
||||||
_json_get_var _tbl_cur JSON_CUR
|
|
||||||
fi
|
|
||||||
local __var="${JSON_PREFIX}KEYS_${_tbl_cur}"
|
|
||||||
eval "export -- \"$__dest=\${$__var}\"; [ -n \"\${$__var+x}\" ]"
|
|
||||||
}
|
|
||||||
|
|
||||||
# function to "sed" unwanted string parts from DATFILE
|
|
||||||
cleanup() {
|
|
||||||
# based on the sample output on cloudflare.com homepage we need to do some cleanup
|
|
||||||
sed -i 's/^[ \t]*//;s/[ \t]*$//' $DATFILE # remove invisible chars at beginning and end of lines
|
|
||||||
sed -i '/^-$/d' $DATFILE # remove lines with "-" (dash)
|
|
||||||
sed -i '/^$/d' $DATFILE # remove empty lines
|
|
||||||
sed -i "#'##g" $DATFILE # remove "'" (single quote)
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$rec_id" ] && __RECID="$rec_id" || {
|
|
||||||
# build url according to cloudflare client api at https://www.cloudflare.com/docs/client-api.html
|
|
||||||
# to "rec_load_all" to detect rec_id needed for update
|
|
||||||
__URL="https://www.cloudflare.com/api_json.html" # https://www.cloudflare.com/api_json.html
|
|
||||||
__URL="${__URL}?a=rec_load_all" # -d 'a=rec_load_all'
|
|
||||||
__URL="${__URL}&tkn=$password" # -d 'tkn=8afbe6dea02407989af4dd4c97bb6e25'
|
|
||||||
__URL="${__URL}&email=$username" # -d 'email=sample@example.com'
|
|
||||||
__URL="${__URL}&z=$__DOMAIN" # -d 'z=example.com'
|
|
||||||
|
|
||||||
# lets request the data
|
|
||||||
do_transfer "$__URL" || return 1
|
|
||||||
|
|
||||||
cleanup # cleanup dat file
|
|
||||||
json_load "$(cat $DATFILE)" # lets extract data
|
|
||||||
__FOUND=0 # found record indicator
|
|
||||||
json_get_var __RES "result" # cloudflare result of last request
|
|
||||||
json_get_var __MSG "msg" # cloudflare error message
|
|
||||||
[ "$__RES" != "success" ] && {
|
|
||||||
write_log 4 "'rec_load_all' failed with error: \n$__MSG"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
json_select "response"
|
|
||||||
json_select "recs"
|
|
||||||
json_select "objs"
|
|
||||||
json_get_keys __KEYS
|
|
||||||
for __KEY in $__KEYS; do
|
|
||||||
local __ZONE __DISPLAY __NAME __TYPE
|
|
||||||
json_select "$__KEY"
|
|
||||||
# json_get_var __ZONE "zone_name" # for debugging
|
|
||||||
# json_get_var __DISPLAY "display_name" # for debugging
|
|
||||||
json_get_var __NAME "name"
|
|
||||||
json_get_var __TYPE "type"
|
|
||||||
if [ "$__NAME" = "$__FQDN" ]; then
|
|
||||||
# we must verify IPv4 and IPv6 because there might be both for the same host
|
|
||||||
[ \( $use_ipv6 -eq 0 -a "$__TYPE" = "A" \) -o \( $use_ipv6 -eq 1 -a "$__TYPE" = "AAAA" \) ] && {
|
|
||||||
__FOUND=1 # mark found
|
|
||||||
break # found leave for loop
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
json_select ..
|
|
||||||
done
|
|
||||||
[ $__FOUND -eq 0 ] && {
|
|
||||||
# we don't need to continue trying to update cloudflare because record to update does not exist
|
|
||||||
# user has to setup record first outside ddns-scripts
|
|
||||||
write_log 14 "No valid record found at Cloudflare setup. Please create first!"
|
|
||||||
}
|
|
||||||
json_get_var __RECID "rec_id" # last thing to do get rec_id
|
|
||||||
json_cleanup # cleanup
|
|
||||||
write_log 7 "rec_id '$__RECID' detected for host/domain '$__FQDN'"
|
|
||||||
}
|
|
||||||
|
|
||||||
# build url according to cloudflare client api at https://www.cloudflare.com/docs/client-api.html
|
|
||||||
# for "rec_edit" to update IP address
|
|
||||||
__URL="https://www.cloudflare.com/api_json.html" # https://www.cloudflare.com/api_json.html
|
|
||||||
__URL="${__URL}?a=rec_edit" # -d 'a=rec_edit'
|
|
||||||
__URL="${__URL}&tkn=$password" # -d 'tkn=8afbe6dea02407989af4dd4c97bb6e25'
|
|
||||||
__URL="${__URL}&id=$__RECID" # -d 'id=9001'
|
|
||||||
__URL="${__URL}&email=$username" # -d 'email=sample@example.com'
|
|
||||||
__URL="${__URL}&z=$__DOMAIN" # -d 'z=example.com'
|
|
||||||
|
|
||||||
[ $use_ipv6 -eq 0 ] && __URL="${__URL}&type=A" # -d 'type=A' (IPv4)
|
|
||||||
[ $use_ipv6 -eq 1 ] && __URL="${__URL}&type=AAAA" # -d 'type=AAAA' (IPv6)
|
|
||||||
|
|
||||||
# handle subdomain or domain record
|
|
||||||
[ -n "$__SUBDOM" ] && __URL="${__URL}&name=$__SUBDOM" # -d 'name=sub' (HOST/SUBDOMAIN)
|
|
||||||
[ -z "$__SUBDOM" ] && __URL="${__URL}&name=$__DOMAIN" # -d 'name=example.com'(DOMAIN)
|
|
||||||
|
|
||||||
__URL="${__URL}&content=$__IP" # -d 'content=1.2.3.4'
|
|
||||||
__URL="${__URL}&service_mode=0" # -d 'service_mode=0'
|
|
||||||
__URL="${__URL}&ttl=1" # -d 'ttl=1'
|
|
||||||
|
|
||||||
# lets do the update
|
|
||||||
do_transfer "$__URL" || return 1
|
|
||||||
|
|
||||||
cleanup # cleanup tmp file
|
|
||||||
json_load "$(cat $DATFILE)" # lets extract data
|
|
||||||
json_get_var __RES "result" # cloudflare result of last request
|
|
||||||
json_get_var __MSG "msg" # cloudflare error message
|
|
||||||
[ "$__RES" != "success" ] && {
|
|
||||||
write_log 4 "'rec_edit' failed with error:\n$__MSG"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
write_log 7 "Update of rec_id '$__RECID' successful"
|
|
||||||
return 0
|
|
|
@ -14,7 +14,8 @@
|
||||||
# option username - your cloudflare e-mail
|
# option username - your cloudflare e-mail
|
||||||
# option password - cloudflare api key, you can get it from cloudflare.com/my-account/
|
# option password - cloudflare api key, you can get it from cloudflare.com/my-account/
|
||||||
# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
|
# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
|
||||||
# option param_opt - Whether the record is receiving the performance and security benefits of Cloudflare (not empty => false)
|
#
|
||||||
|
# The proxy status would not be changed by this script. Please change it in Cloudflare dashboard manually.
|
||||||
#
|
#
|
||||||
# variable __IP already defined with the ip-address to use for update
|
# variable __IP already defined with the ip-address to use for update
|
||||||
#
|
#
|
||||||
|
@ -176,11 +177,8 @@ __DATA=$(grep -o '"content":"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||||
|
|
||||||
# update is needed
|
# update is needed
|
||||||
# let's build data to send
|
# let's build data to send
|
||||||
# set proxied parameter (default "true")
|
# set proxied parameter
|
||||||
[ -z "$param_opt" ] && __PROXIED="true" || {
|
__PROXIED=$(grep -o '"proxied":[^",]*' $DATFILE | grep -o '[^:]*$')
|
||||||
__PROXIED="false"
|
|
||||||
write_log 7 "Cloudflare 'proxied' disabled"
|
|
||||||
}
|
|
||||||
|
|
||||||
# use file to work around " needed for json
|
# use file to work around " needed for json
|
||||||
cat > $DATFILE << EOF
|
cat > $DATFILE << EOF
|
||||||
|
|
|
@ -11,7 +11,7 @@ XMLDATA="<?xml version='1.0'?><methodCall><methodName>xname.updateArecord</metho
|
||||||
XMLDATA=$(echo $XMLDATA | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
XMLDATA=$(echo $XMLDATA | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
||||||
-e "s#\[ZONENAME\]#$zone#g" -e "s#\[RECORDNAME\]#$record#g" -e "s#\[IP\]#$__IP#g")
|
-e "s#\[ZONENAME\]#$zone#g" -e "s#\[RECORDNAME\]#$record#g" -e "s#\[IP\]#$__IP#g")
|
||||||
$PROG -d "$XMLDATA" -o $DATFILE $__URL || return 1
|
$PROG -d "$XMLDATA" -o $DATFILE $__URL || return 1
|
||||||
write_log 7 "'freedns.42.pl' answered:\n$(cat $DATFILE)"
|
write_log 7 "'freedns.42.pl' answered:${N}$(cat $DATFILE)"
|
||||||
grep "<fault>" $DATFILE > /dev/null 2>&1 && return 1
|
grep "<fault>" $DATFILE > /dev/null 2>&1 && return 1
|
||||||
grep '<name>serial</name>' $DATFILE >/dev/null 2>&1
|
grep '<name>serial</name>' $DATFILE >/dev/null 2>&1
|
||||||
return $?
|
return $?
|
||||||
|
|
|
@ -26,7 +26,7 @@ __URL=$(echo $__UPDURL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#
|
||||||
|
|
||||||
do_transfer "$__URL" || return 1
|
do_transfer "$__URL" || return 1
|
||||||
|
|
||||||
write_log 7 "'no-ip.com' answered:\n$(cat $DATFILE)"
|
write_log 7 "'no-ip.com' answered:${N}$(cat $DATFILE)"
|
||||||
# analyse provider answers
|
# analyse provider answers
|
||||||
# "good [IP_ADR]" = successful
|
# "good [IP_ADR]" = successful
|
||||||
# "nochg [IP_ADR]" = no change but OK
|
# "nochg [IP_ADR]" = no change but OK
|
||||||
|
@ -43,7 +43,7 @@ __URL=$(echo $__UPDURL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#
|
||||||
|
|
||||||
do_transfer "$__URL" || return 1
|
do_transfer "$__URL" || return 1
|
||||||
|
|
||||||
write_log 7 "'no-ip.com' answered:\n$(cat $DATFILE)"
|
write_log 7 "'no-ip.com' answered:${N}$(cat $DATFILE)"
|
||||||
# analyse provider answers
|
# analyse provider answers
|
||||||
# "good [IP_ADR]" = successful
|
# "good [IP_ADR]" = successful
|
||||||
# "nochg [IP_ADR]" = no change but OK
|
# "nochg [IP_ADR]" = no change but OK
|
||||||
|
|
|
@ -43,6 +43,6 @@ EOF
|
||||||
$__PROG -d $__TCP $DATFILE >$ERRFILE 2>&1
|
$__PROG -d $__TCP $DATFILE >$ERRFILE 2>&1
|
||||||
|
|
||||||
# nsupdate always return success
|
# nsupdate always return success
|
||||||
write_log 7 "(k)nsupdate reports:\n$(cat $ERRFILE)"
|
write_log 7 "(k)nsupdate reports:${N}$(cat $ERRFILE)"
|
||||||
|
|
||||||
return 0
|
return 0
|
|
@ -1,39 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
URL="https://publicsuffix.org/list/public_suffix_list.dat"
|
|
||||||
TMPFILE=$(dirname $0)/public_suffix_list.tmp
|
|
||||||
DATFILE=$(dirname $0)/public_suffix_list.dat
|
|
||||||
|
|
||||||
wget -O $TMPFILE $URL || exit 1
|
|
||||||
|
|
||||||
# there might be backslashes (at line end they produce problems)
|
|
||||||
sed -i 's/\\//g' $TMPFILE
|
|
||||||
|
|
||||||
# clear DATFILE if exist
|
|
||||||
printf %s "" > $DATFILE
|
|
||||||
L=0; M=0
|
|
||||||
export CHARSET=UTF-8 # needed for idn
|
|
||||||
cat ${TMPFILE} | while read LINE; do
|
|
||||||
L=$(( L + 1 ))
|
|
||||||
printf "\\r\\t%s\\t%s" "in: $L " "out: $(( $L + $M )) "
|
|
||||||
printf %s\\n "$LINE" | grep -E "^\/\/" >/dev/null 2>&1 && {
|
|
||||||
# do not modify lines beginning with "//"
|
|
||||||
printf %s\\n "$LINE" >> $DATFILE
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
printf %s\\n "$LINE" | grep -E "^$" >/dev/null 2>&1 && {
|
|
||||||
# do not modify empty lines
|
|
||||||
printf %s\\n "$LINE" >> $DATFILE
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
ASCII=$(idn -a "$LINE") # write ASCII and UTF-8
|
|
||||||
if [ "$ASCII" != "$LINE" ]; then
|
|
||||||
printf %s\\n "$ASCII" >> $DATFILE
|
|
||||||
printf "\\t%s\\n" "add: $ASCII"
|
|
||||||
M=$(( M + 1 ))
|
|
||||||
fi
|
|
||||||
printf %s\\n "$LINE" >> $DATFILE
|
|
||||||
done
|
|
||||||
rm -f $TMPFILE
|
|
||||||
gzip -f9 $DATFILE
|
|
||||||
|
|
Loading…
Reference in a new issue