mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
[for-15.05] ddns-scripts: backport of 2.7.6-10
Backport of current version 2.7.6-10 - more services - more functionality - be prepared for next versions compiled ipk-packages available at https://github.com/chris5560/OpenWrt-Backports/tree/master/for-CC15.05.01/ddns-scripts_2.7.6-10 Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/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
|
||||
|
||||
Reference in New Issue
Block a user