packages/net/ddns-scripts/tools/public_suffix_list.sh
Christian Schoenebeck 1c20dcb71a ddns-scripts: update to 2.7.6-1
- tld_names.dat.gz
  - rename to public_suffix_list.dat.gz
  - (re)created during build
  - new location /usr/share
- move services files to /etc/ddns
- new services
  - CloudFlare.com-v4 using API-Version 4 without using public_suffix_list.dat
  - GoDaddy.com
  - both depending on cURL package
  - both with modified syntax for option domain ( NEW: [host[.subdom]@]domain.tld )
- new service
  - Now-DNS.com formerly Now-IP.com
- service afraid.org now supports key-auth and basic-auth
- new command line options for dynamic_dns_updater.sh and dynamic_dns_updater.sh
- adapted ddns.init and ddns.hotplug to new command line options
- renaming config options inside section global

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2016-12-04 16:47:09 +01:00

39 lines
1 KiB
Bash
Executable file

#!/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