From 20da9e28b3c5ac2f47e77026c4173ccf9ea225e5 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sun, 11 Sep 2022 12:45:51 +0200 Subject: [PATCH] adblock: update 4.1.4-2 * some more cleanups, forgotten with the last update * optimized unbound syntax ('always_nxdomain' & 'always_transparent') * optimized oisd download sources (use wilcard variants which are much smaller) * removed superfluous version information/function Signed-off-by: Dirk Brenken (cherry picked from commit 54f493ed9d283620d8bbf468df5c024eed383dbb) --- net/adblock/Makefile | 2 +- net/adblock/files/adblock.init | 8 +------- net/adblock/files/adblock.sh | 21 +++++++-------------- net/adblock/files/adblock.sources | 12 ++++++------ 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/net/adblock/Makefile b/net/adblock/Makefile index 6394efe04..50fc425ed 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock PKG_VERSION:=4.1.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Dirk Brenken diff --git a/net/adblock/files/adblock.init b/net/adblock/files/adblock.init index 9b2d14f68..e5a914b41 100755 --- a/net/adblock/files/adblock.init +++ b/net/adblock/files/adblock.init @@ -15,7 +15,6 @@ if [ -n "$(type -t extra_command)" ]; then extra_command "report" "[[|||] [] []] Print DNS statistics with an optional search parameter" extra_command "list" "[|||||||||] List/Edit available sources" extra_command "timer" "[ [] []]|[ ] List/Edit cron update intervals" - extra_command "version" "Print version information" else EXTRA_COMMANDS="status suspend resume query report list timer version" EXTRA_HELP=" status Service status @@ -24,8 +23,7 @@ else query Query active blocklists and backups for a specific domain report [[|||] [] []] Print DNS statistics with an optional search parameter list [|||||||||] List/Edit available sources - timer [ [] []]|[ ] List/Edit cron update intervals - version Print version information" + timer [ [] []]|[ ] List/Edit cron update intervals" fi adb_init="/etc/init.d/adblock" @@ -39,10 +37,6 @@ if [ -s "${adb_pidfile}" ] && { [ "${action}" = "start" ] || [ "${action}" = "st exit 0 fi -version() { - rc_procd "${adb_script}" version -} - boot() { [ -s "${adb_pidfile}" ] && : >"${adb_pidfile}" rc_procd start_service diff --git a/net/adblock/files/adblock.sh b/net/adblock/files/adblock.sh index c4465fb8d..e573c1826 100755 --- a/net/adblock/files/adblock.sh +++ b/net/adblock/files/adblock.sh @@ -70,7 +70,7 @@ f_load() { "${adb_awk}" 'BEGIN{RS="";FS="\n"}{printf "%s, %s",$1,$2}')" adb_memory="$("${adb_awk}" '/^MemTotal|^MemFree|^MemAvailable/{ORS="/"; print int($2/1000)}' "/proc/meminfo" 2>/dev/null | "${adb_awk}" '{print substr($0,1,length($0)-1)}')" - + f_conf cpu="$(grep -c '^processor' /proc/cpuinfo 2>/dev/null)" @@ -78,7 +78,7 @@ f_load() { [ "${cpu}" = "0" ] && cpu="1" [ "${core}" = "0" ] && core="1" adb_cores="$((cpu * core))" - + if [ "${adb_action}" != "report" ]; then f_dns f_fetch @@ -104,7 +104,7 @@ f_load() { if [ -x "${adb_dumpcmd}" ] && { [ "${adb_report}" = "0" ] || { [ -n "${bg_pid}" ] && { [ "${adb_action}" = "stop" ] || [ "${adb_action}" = "restart" ]; }; }; }; then if [ -n "${bg_pid}" ]; then kill -HUP "${bg_pid}" 2>/dev/null - while $(kill -0 "${bg_pid}" 2>/dev/null); do + while kill -0 "${bg_pid}" 2>/dev/null; do sleep 1 done unset bg_pid @@ -270,10 +270,10 @@ f_dns() { adb_dnsuser="${adb_dnsuser:-"unbound"}" adb_dnsdir="${adb_dnsdir:-"/var/lib/unbound"}" adb_dnsheader="${adb_dnsheader:-""}" - adb_dnsdeny="${adb_dnsdeny:-"${adb_awk} '{print \"local-zone: \\042\"\$0\"\\042 static\"}'"}" - adb_dnsallow="${adb_dnsallow:-"${adb_awk} '{print \"local-zone: \\042\"\$0\"\\042 transparent\"}'"}" + adb_dnsdeny="${adb_dnsdeny:-"${adb_awk} '{print \"local-zone: \\042\"\$0\"\\042 always_nxdomain\"}'"}" + adb_dnsallow="${adb_dnsallow:-"${adb_awk} '{print \"local-zone: \\042\"\$0\"\\042 always_transparent\"}'"}" adb_dnssafesearch="${adb_dnssafesearch:-"${adb_awk} -v item=\"\$item\" '{type=\"AAAA\";if(match(item,/^([0-9]{1,3}\.){3}[0-9]{1,3}$/)){type=\"A\"}}{print \"local-data: \\042\"\$0\" \"type\" \"item\"\\042\"}'"}" - adb_dnsstop="${adb_dnsstop:-"local-zone: \".\" static"}" + adb_dnsstop="${adb_dnsstop:-"local-zone: \".\" always_nxdomain"}" ;; "named") adb_dnscachecmd="$(command -v rndc || printf "%s" "-")" @@ -625,7 +625,7 @@ f_dnsup() { dns_service="$(ubus -S call service list "{\"name\":\"${adb_dns}\"}")" dns_up="$(printf "%s" "${dns_service}" | jsonfilter -l1 -e "@[\"${adb_dns}\"].instances.*.running")" dns_pid="$(printf "%s" "${dns_service}" | jsonfilter -l1 -e "@[\"${adb_dns}\"].instances.*.pid")" - if [ "${dns_up}" = "true" ] && [ -n "${dns_pid}" ] && ! ls -l "/proc/${dns_pid}/fd" 2>/dev/null | grep -q "${adb_dnsdir}/${adb_dnsfile}"; then + if [ "${dns_up}" = "true" ] && [ -n "${dns_pid}" ] && ! ls "/proc/${dns_pid}/fd/${adb_dnsdir}/${adb_dnsfile}" >/dev/null 2>&1; then if [ -x "${adb_lookupcmd}" ] && [ "${adb_lookupdomain}" != "false" ]; then if "${adb_lookupcmd}" "${adb_lookupdomain}" >/dev/null 2>&1; then out_rc="0" @@ -1434,13 +1434,6 @@ else f_log "err" "system libraries not found" fi -# version information -# -if [ "${adb_action}" = "version" ]; then - printf "%s\n" "${adb_ver}" - exit 0 -fi - # awk check # adb_awk="$(command -v gawk)" diff --git a/net/adblock/files/adblock.sources b/net/adblock/files/adblock.sources index 4e02221ff..806b50d9f 100644 --- a/net/adblock/files/adblock.sources +++ b/net/adblock/files/adblock.sources @@ -98,22 +98,22 @@ "descurl": "https://github.com/notracking/hosts-blocklists" }, "oisd_basic": { - "url": "https://dbl.oisd.nl/basic/", - "rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}", + "url": "https://dblw.oisd.nl/basic/", + "rule": "/^\\*\\.([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}", "size": "L", "focus": "general", "descurl": "https://oisd.nl" }, "oisd_nsfw": { - "url": "https://dbl.oisd.nl/nsfw/", - "rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}", + "url": "https://dblw.oisd.nl/nsfw/", + "rule": "/^\\*\\.([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}", "size": "XL", "focus": "general", "descurl": "https://oisd.nl" }, "oisd_full": { - "url": "https://dbl.oisd.nl", - "rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}", + "url": "https://dblw.oisd.nl", + "rule": "/^\\*\\.([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}", "size": "XXL", "focus": "general", "descurl": "https://oisd.nl"