From acafc3c40e31e3187fa88e3a1fde6d2047c1d461 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Thu, 29 Jun 2017 15:34:18 +0200 Subject: [PATCH] adblock: update 2.8.2 * made DNS restart conditional (compare list hash values), to prevent needless restarts of the DNS backend Signed-off-by: Dirk Brenken --- net/adblock/Makefile | 2 +- net/adblock/files/adblock.sh | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/net/adblock/Makefile b/net/adblock/Makefile index 5141a7607..4b387977e 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock -PKG_VERSION:=2.8.1 +PKG_VERSION:=2.8.2 PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Dirk Brenken diff --git a/net/adblock/files/adblock.sh b/net/adblock/files/adblock.sh index 04c19066b..7c3112877 100755 --- a/net/adblock/files/adblock.sh +++ b/net/adblock/files/adblock.sh @@ -10,7 +10,7 @@ # LC_ALL=C PATH="/usr/sbin:/usr/bin:/sbin:/bin" -adb_ver="2.8.1" +adb_ver="2.8.2" adb_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')" adb_enabled=1 adb_debug=0 @@ -436,7 +436,7 @@ f_log() # f_main() { - local src_name src_rset shalla_archive enabled url cnt=0 + local src_name src_rset shalla_archive enabled url hash_old hash_new cnt=0 local mem_total="$(awk '/^MemTotal/ {print int($2/1000)}' "/proc/meminfo")" f_log "info " "start adblock processing ..." @@ -535,8 +535,12 @@ f_main() fi done - # overall sort + # hash preparation & overall sort # + if [ -f "${adb_dnsdir}/${adb_dnsfile}" ] + then + hash_old="$(sha256sum "${adb_dnsdir}/${adb_dnsfile}" | awk '{print $1}')" + fi if [ -s "${adb_tmpdir}/${adb_dnsfile}" ] then if [ ${mem_total} -ge 64 ] || [ ${adb_forcesrt} -eq 1 ] @@ -548,13 +552,17 @@ f_main() else > "${adb_dnsdir}/${adb_dnsfile}" fi + hash_new="$(sha256sum "${adb_dnsdir}/${adb_dnsfile}" | awk '{print $1}')" cnt="$(wc -l < "${adb_dnsdir}/${adb_dnsfile}")" - # restart the dns backend and export runtime information + # conditional restart of the dns backend and runtime information export # chown "${adb_dns}":"${adb_dns}" "${adb_dnsdir}/${adb_dnsfile}" 2>/dev/null f_rmtemp - f_dnsrestart + if [ "${hash_old}" != "${hash_new}" ] + then + f_dnsrestart + fi if [ ${?} -eq 0 ] then json_init