adblock: update 4.5.5-4
authorDirk Brenken <redacted>
Sat, 16 May 2026 20:49:56 +0000 (22:49 +0200)
committerDirk Brenken <redacted>
Sat, 16 May 2026 20:49:56 +0000 (22:49 +0200)
- gated f_load behind a ubus socket check at the end of adblock.sh
   to harden against pre-ubus invocations
- added a 'adb_bver' fallback in f_log for invocation paths without prior f_load execution
- minor code improvements and fixes

Signed-off-by: Dirk Brenken <redacted>
net/adblock/Makefile
net/adblock/files/adblock.sh

index 74e2c11e172a751f129cb111dfd1c9f9b9bac68c..e4d41b546fe054d824caf281678e8fe5e5309d6a 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
 PKG_VERSION:=4.5.5
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 97f042ef51856cfeb3820b4d9ff4acab10bc1709..6b1fe27592dc0127d013f97349064cd5c4eed8a3 100755 (executable)
@@ -1722,13 +1722,13 @@ f_log() {
 
        if [ -n "${log_msg}" ] && { [ "${class}" != "debug" ] || [ "${adb_debug}" = "1" ]; }; then
                if [ -x "${adb_loggercmd}" ]; then
-                       "${adb_loggercmd}" -p "${class}" -t "adblock-${adb_bver}[${$}]" "${log_msg::512}"
+                       "${adb_loggercmd}" -p "${class}" -t "adblock-${adb_bver:-"-"}[${$}]" "${log_msg::512}"
                else
-                       printf '%s %s %s\n' "${class}" "adblock-${adb_bver}[${$}]" "${log_msg::512}"
+                       printf '%s %s %s\n' "${class}" "adblock-${adb_bver:-"-"}[${$}]" "${log_msg::512}" >&2
                fi
                if [ "${class}" = "err" ] || [ "${class}" = "emerg" ]; then
                        [ "${adb_action}" != "mail" ] && f_rmdns
-                       f_jsnup "error"
+                       [ -s "${adb_rtfile}" ] && f_jsnup "error"
                        exit 1
                fi
        fi
@@ -2435,16 +2435,6 @@ f_report() {
        esac
 }
 
-# source required system libraries
-#
-if [ -r "/lib/functions.sh" ] && [ -r "/lib/functions/network.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]; then
-       . "/lib/functions.sh"
-       . "/lib/functions/network.sh"
-       . "/usr/share/libubox/jshn.sh"
-else
-       f_log "err" "system libraries not found"
-fi
-
 # create runtime directory if it doesn't exist
 #
 [ ! -d "${adb_rundir}" ] && mkdir -p "${adb_rundir}"
@@ -2474,9 +2464,22 @@ adb_mailcmd="$(f_cmd msmtp optional)"
 adb_logreadcmd="$(f_cmd logread optional)"
 adb_nftcmd="$(f_cmd nft)"
 
+# source required system libraries
+#
+if [ -r "/lib/functions.sh" ] && [ -r "/lib/functions/network.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]; then
+       . "/lib/functions.sh"
+       . "/lib/functions/network.sh"
+       . "/usr/share/libubox/jshn.sh"
+else
+       f_log "err" "system libraries not found"
+fi
+
+# initial system load
+#
+[ -S "/var/run/ubus/ubus.sock" ] && f_load
+
 # handle different adblock actions
 #
-f_load
 case "${adb_action}" in
 "stop")
        f_temp
git clone https://git.99rst.org/PROJECT