adblock: update 4.5.2‑2

* fixed the debug errorfile handling
* fixed a typo in the nftadd function
* minor cornercase improvements
* LuCI: minor cleanups & fixes

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2026-03-05 21:03:45 +01:00
parent f24ebb4f11
commit 57ec85084c
2 changed files with 18 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
PKG_VERSION:=4.5.2
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>

View File

@@ -106,11 +106,11 @@ f_load() {
# load adblock config and set debug log file
#
f_conf
if [ "${adb_debug}" = "1" ]; then
if [ "${adb_debug}" = "1" ] && [ -d "${adb_basedir}" ]; then
adb_errorlog="${adb_basedir}/adb_error.log"
: > "${adb_errorlog}"
else
rm -f "${adb_errorlog}"
adb_errorlog="/dev/null"
fi
# fetch installed packages amd system information
@@ -133,18 +133,6 @@ f_load() {
[ "${adb_cores}" -gt "16" ] && adb_cores="16"
fi
# check if adblock is enabled
#
if [ "${adb_enabled}" = "0" ]; then
f_extconf
f_temp
f_nftremove
f_rmdns
f_jsnup "disabled"
f_log "info" "adblock is currently disabled, please set the config option 'adb_enabled' to '1' to use this service"
exit 0
fi
# load dns backend and fetch utility
#
if [ "${adb_action}" != "report" ] && [ "${adb_action}" != "mail" ]; then
@@ -476,6 +464,17 @@ f_dns() {
fi
fi
# check if adblock is enabled
#
if [ "${adb_enabled}" = "0" ]; then
f_temp
f_nftremove
f_rmdns
f_jsnup "disabled"
f_log "info" "adblock is currently disabled, please set the config option 'adb_enabled' to '1' to use this service"
exit 0
fi
f_log "debug" "f_dns ::: dns: ${adb_dns}, dns_instance: ${adb_dnsinstance}, dns_user: ${adb_dnsuser}, dns_dir: ${adb_dnsdir}, backup_dir: ${adb_backupdir}, final_dir: ${adb_finaldir}"
}
@@ -551,7 +550,7 @@ f_temp() {
#
f_rmtemp() {
[ -f "${adb_errorlog}" ] && [ ! -s "${adb_errorlog}" ] && rm -f "${adb_errorlog}"
rm -rf "${adb_tmpdir}"
[ -d "${adb_tmpdir}" ] && rm -rf "${adb_tmpdir}"
: >"${adb_pidfile}"
}
@@ -561,7 +560,7 @@ f_rmdns() {
printf "%b" "${adb_dnsheader}" >"${adb_finaldir}/${adb_dnsfile}"
f_dnsup
f_rmtemp
if [ "${adb_action}" = "stop" ] || [ "${adb_enabled}" = "0" ]; then
if [ -d "${adb_backupdir}" ] && { [ "${adb_action}" = "stop" ] || [ "${adb_enabled}" = "0" ]; }; then
"${adb_findcmd}" "${adb_backupdir}" -maxdepth 1 -type f -name '*.gz' -exec rm -f {} +
fi
}
@@ -784,7 +783,7 @@ f_nftadd() {
#
if [ "${adb_nftallow}" = "0" ] && [ "${adb_nftblock}" = "0" ] \
&& [ "${adb_nftremote}" = "0" ] && [ "${adb_nftforce}" = "0" ] \
&& [ "${adb_nftbridging}" = "0" ]; then
&& [ "${adb_nftbridge}" = "0" ]; then
return
fi
@@ -1399,7 +1398,7 @@ f_jsnup() {
json_add_string "dns_backend" "${adb_dns:-"-"} (${dns_ver:-"-"}), ${adb_finaldir:-"-"}, ${dns_mem:-"0"} MB"
json_add_string "run_ifaces" "trigger: ${adb_trigger:-"-"}, report: ${adb_repiface:-"-"}"
json_add_string "run_information" "base: ${adb_basedir}, dns: ${adb_dnsdir}, backup: ${adb_backupdir}, report: ${adb_reportdir}, error: ${adb_errorlog}"
json_add_string "run_flags" "shift: $(f_char ${adb_dnsshift}), custom feed: $(f_char ${custom_feed}), ext. DNS (std/prot/remote/bridge): $(f_char ${nft_unfiltered})/$(f_char ${nft_filtered})/$(f_char ${nft_remote})/$(f_char ${nft_bridge}), force: $(f_char ${nft_force}), flush: $(f_char ${adb_dnsflush}), tld: $(f_char ${adb_tld}), search: $(f_char ${adb_safesearch}), report: $(f_char ${adb_report}), mail: $(f_char ${adb_mail}), jail: $(f_char ${jail})"
json_add_string "run_flags" "shift: $(f_char ${adb_dnsshift}), custom feed: $(f_char ${custom_feed}), ext. DNS (std/prot/remote/bridge): $(f_char ${nft_unfiltered})/$(f_char ${nft_filtered})/$(f_char ${nft_remote})/$(f_char ${nft_bridge}), force: $(f_char ${nft_force}), flush: $(f_char ${adb_dnsflush}), tld: $(f_char ${adb_tld}), search: $(f_char ${adb_safesearch}), report: $(f_char ${adb_report}), mail: $(f_char ${adb_mail}), jail: $(f_char ${jail}), debug: $(f_char ${adb_debug})"
json_add_string "last_run" "${runtime:-"-"}"
json_add_string "system_info" "cores: ${adb_cores}, fetch: ${adb_fetchcmd##*/}, ${adb_sysver}"
json_dump >"${adb_rtfile}"