include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
-PKG_VERSION:=4.5.7
-PKG_RELEASE:=4
+PKG_VERSION:=4.5.8
+PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
define Package/adblock/description
adblock blocks ad/abuse domains via dnsmasq, unbound, named, smartdns or kresd.
adblock consumes a minimum of memory, is very fast and supports many domain blocklist sites plus local block- and allowlist overrides.
-Please see https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md for further information.
+Please see https://github.com/openwrt/packages/blob/master/net/adblock/README.md for further information.
endef
## Quick Start
For a typical setup these few steps are enough to get adblock up and running — see the sections below for details:
1. Install the LuCI companion package: `apk update && apk add luci-app-adblock` (this pulls in the `adblock` backend as a dependency).
-2. Enable the adblock system service under `System → Startup`, then open LuCI under `Services → Adblock`, tick `Enabled` and (recommended) set a `Startup Trigger Interface` to your WAN interface (avoid IPv6/wan6).
+2. Enable the adblock system service under `System → Startup`, then open LuCI under `Services → Adblock`, tick `Enabled` and (recommended) set a `Startup Trigger Interface` to your WAN interface(s).
3. Keep the small, pre-selected default feed selection to start with (e.g. `adguard`, `adguard_tracking` and `certpl`, ≈280K domains).
4. Start and verify the service:
* Install the LuCI companion package `luci-app-adblock` which also installs the main `adblock` package as a dependency
* Enable the adblock system service (System -> Startup) and enable adblock itself (adblock -> General Settings)
* It's strongly recommended to use the LuCI frontend to easily configure all aspects of adblock, the application is located in LuCI under the `Services` menu
-* It's also recommended to configure a `Startup Trigger Interface` to depend on your WAN ifup events during boot or restart of your router. Avoid IPv6 (wan6) interfaces here, as IPv6/netifd is chatty and would trigger frequent unnecessary adblock restarts
+* It's also recommended to configure a `Startup Trigger Interface` to depend on your WAN interface events during boot or restart of your router. Listing IPv6 interfaces (wan6) is fine as well: a trigger only starts a run if the last one did not succeed, so the chatty netifd update events no longer cause repeated downloads
<a id="adblock-cli-interface"></a>
## Adblock CLI interface
| adb_fetchparm | -, auto-detected | manually override the config options for the selected download utility |
| adb_fetchretry | 5 | number of download attempts in case of an error (not supported by uclient-fetch) |
| adb_fetchinsecure | 0, disabled | don't check SSL server certificates during download |
-| adb_trigger | -, not set | logical reload trigger interface(s), e.g. `wan` (avoid IPv6 interfaces) |
+| adb_trigger | -, not set | logical reload trigger interface(s), e.g. `wan` and `wan6` |
| adb_triggerdelay | 5 | additional trigger delay in seconds before adblock processing begins |
| adb_debug | 0, disabled | set to 1 to enable the debug output |
| adb_nicelimit | 0, standard prio. | valid nice level range 0-19 of the adblock processes |
adb_script="/usr/bin/adblock.sh"
adb_rundir="/var/run/adblock"
adb_pidfile="/var/run/adblock/adblock.pid"
+adb_rtfile="/var/run/adblock/adblock.runtime.json"
if [ -z "${IPKG_INSTROOT}" ]; then
}
start_service() {
+ local status
+
if "${adb_init}" enabled; then
if [ "${action}" = "boot" ]; then
[ -n "$(uci_get adblock global adb_trigger)" ] && return 0
fi
+ if [ "${1}" = "refresh" ]; then
+ json_init
+ json_load_file "${adb_rtfile}" >/dev/null 2>&1
+ json_get_var status "adblock_status"
+ [ -n "${status}" ] && [ "${status}" != "error" ] && return 0
+ fi
+
procd_open_instance "adblock"
- procd_set_param command "${adb_script}" "${@:-"${action}"}"
+ procd_set_param command "${adb_script}" "${action}"
procd_set_param pidfile "${adb_pidfile}"
procd_set_param nice "$(uci_get adblock global adb_nicelimit "0")"
procd_set_param stdout 0
local key keylist type value values
json_init
- json_load_file "/var/run/adblock/adblock.runtime.json" >/dev/null 2>&1
+ json_load_file "${adb_rtfile}" >/dev/null 2>&1
json_get_keys keylist
if [ -n "${keylist}" ]; then
printf '%s\n' "::: adblock runtime information"
PROCD_RELOAD_DELAY="$((delay * 1000))"
for iface in ${trigger}; do
- procd_add_interface_trigger "interface.*.up" "${iface}" "${adb_init}" start
+ procd_add_interface_trigger "interface.*" "${iface}" "${adb_init}" start refresh
done
}