From 7ebd92f997136cec0dc0fb20ddc06e88bc05441e Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Thu, 7 Jul 2016 12:42:37 +0200 Subject: [PATCH] adblock: update 1.3.3 * enable automatic restore on empty source downloads Signed-off-by: Dirk Brenken --- net/adblock/Makefile | 2 +- net/adblock/files/README.md | 2 +- net/adblock/files/adblock-update.sh | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/net/adblock/Makefile b/net/adblock/Makefile index 78f16acc3..106fc6db4 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock -PKG_VERSION:=1.3.2 +PKG_VERSION:=1.3.3 PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Dirk Brenken diff --git a/net/adblock/files/README.md b/net/adblock/files/README.md index cab34580d..8ef36be96 100644 --- a/net/adblock/files/README.md +++ b/net/adblock/files/README.md @@ -58,7 +58,7 @@ A lot of people already use adblocker plugins within their desktop browsers, but * status & error logging to stdout and syslog * use two dynamic uhttpd instances as adblock pixel server, separated for ads delivered on port 80 and on port 443 * use dynamic iptables chains/rulesets for adblock related redirects/rejects -* init system support (start/stop/restart/reload/toggle) +* init system support (start/stop/restart/reload/toggle/stats/cfgup) * hotplug support, the adblock start will be triggered by wan 'ifup' event * adblock toggle to quickly switch adblocking 'on' or 'off' * optional: automatic adblock list backup/restore, backups will be (de-)compressed on the fly (disabled by default) diff --git a/net/adblock/files/adblock-update.sh b/net/adblock/files/adblock-update.sh index caf87afbb..94a9e83be 100755 --- a/net/adblock/files/adblock-update.sh +++ b/net/adblock/files/adblock-update.sh @@ -10,7 +10,7 @@ # adb_pid="${$}" adb_pidfile="/var/run/adblock.pid" -adb_scriptver="1.3.2" +adb_scriptver="1.3.3" adb_mincfgver="2.2" adb_scriptdir="${0%/*}" if [ -r "${adb_pidfile}" ] @@ -145,10 +145,23 @@ do unset tmp_domains elif [ $((rc)) -eq 0 ] && [ -z "${tmp_domains}" ] then - "${adb_uci}" -q delete "adblock.${src_name}.adb_src_count" - "${adb_uci}" -q set "adblock.${src_name}.adb_src_timestamp=empty download" - f_log " empty source download, skipped" - continue + if [ "${backup_ok}" = "true" ] && [ -r "${adb_dir_backup}/${adb_dnsprefix}.${src_name}.gz" ] + then + gunzip -cf "${adb_dir_backup}/${adb_dnsprefix}.${src_name}.gz" > "${adb_tmpfile}" + count="$(wc -l < "${adb_tmpfile}")" + "${adb_uci}" -q set "adblock.${src_name}.adb_src_timestamp=list restored" + f_log " empty source download, restored (${count} entries)" + else + if [ -r "${adb_dnsdir}/${adb_dnsprefix}.${src_name}" ] + then + rm -f "${adb_dnsdir}/${adb_dnsprefix}.${src_name}" + rm_done="true" + fi + "${adb_uci}" -q delete "adblock.${src_name}.adb_src_count" + "${adb_uci}" -q set "adblock.${src_name}.adb_src_timestamp=empty download" + f_log " empty source download, skipped" + continue + fi else rc=0 if [ "${backup_ok}" = "true" ] && [ -r "${adb_dir_backup}/${adb_dnsprefix}.${src_name}.gz" ]