diff --git a/net/adblock/Makefile b/net/adblock/Makefile index b72b8cb88c..f72d77b46f 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -6,8 +6,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock -PKG_VERSION:=4.4.0 -PKG_RELEASE:=3 +PKG_VERSION:=4.4.1 +PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Dirk Brenken @@ -23,7 +23,7 @@ endef define Package/adblock/description adblock blocks ad/abuse domains via dnsmasq, unbound, named, smartdns or kresd. -adblock supports many domain blocklist sites plus local block- and allowlist overrides. +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. endef @@ -61,6 +61,9 @@ define Package/adblock/install $(INSTALL_CONF) ./files/adblock.categories $(1)/etc/adblock $(INSTALL_CONF) ./files/adblock.feeds $(1)/etc/adblock $(INSTALL_CONF) ./files/adblock.custom.feeds $(1)/etc/adblock + + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/95-adblock-housekeeping $(1)/etc/uci-defaults endef $(eval $(call BuildPackage,adblock)) diff --git a/net/adblock/files/95-adblock-housekeeping b/net/adblock/files/95-adblock-housekeeping new file mode 100755 index 0000000000..e70d16414e --- /dev/null +++ b/net/adblock/files/95-adblock-housekeeping @@ -0,0 +1,57 @@ +#!/bin/sh +# Copyright (c) 2015-2025 Dirk Brenken (dev@brenken.org) +# This is free software, licensed under the GNU General Public License v3. + +# (s)hellcheck exceptions +# shellcheck disable=all + +export LC_ALL=C +export PATH="/usr/sbin:/usr/bin:/sbin:/bin" + +config="adblock" +old_options="adb_sources adb_forcedns adb_fetchutil adb_hag_sources adb_hst_sources adb_stb_sources adb_utc_sources \ + adb_maxqueue adb_backup adb_dnsfilereset adb_mailcnt adb_safesearchmod adb_srcfile adb_srcarc" + +for option in ${old_options}; do + if uci -q get ${config}.global.${option} >/dev/null 2>&1; then + old_values="$(uci -q get ${config}.global.${option})" + for value in ${old_values}; do + case "${option}" in + "adb_sources") + if ! uci -q get ${config}.global.adb_feed | grep -q "${value}"; then + uci -q add_list ${config}.global.adb_feed="${value}" + fi + ;; + "adb_hag_sources") + if ! uci -q get ${config}.global.adb_hag_feed | grep -q "${value}"; then + uci -q add_list ${config}.global.adb_hag_feed="${value}" + fi + ;; + "adb_hst_sources") + if ! uci -q get ${config}.global.adb_hst_feed | grep -q "${value}"; then + uci -q add_list ${config}.global.adb_hst_feed="${value}" + fi + ;; + "adb_stb_sources") + if ! uci -q get ${config}.global.adb_stb_feed | grep -q "${value}"; then + uci -q add_list ${config}.global.adb_stb_feed="${value}" + fi + ;; + "adb_utc_sources") + if ! uci -q get ${config}.global.adb_utc_feed | grep -q "${value}"; then + uci -q add_list ${config}.global.adb_utc_feed="${value}" + fi + ;; + "adb_forcedns") + uci -q set ${config}.global.adb_dnsforce="${value}" + ;; + "adb_fetchutil") + uci -q set ${config}.global.adb_fetchcmd="${value}" + ;; + esac + done + uci -q delete ${config}.global.${option} + fi +done +[ -n "$(uci -q changes ${config})" ] && uci -q commit ${config} +exit 0 diff --git a/net/adblock/files/README.md b/net/adblock/files/README.md index 071665dd55..7dbb80c499 100644 --- a/net/adblock/files/README.md +++ b/net/adblock/files/README.md @@ -120,13 +120,15 @@ A lot of people already use adblocker plugins within their desktop browsers, but **Please note:** * Devices with less than 128MB of RAM are **_not_** supported * For performance reasons, adblock depends on gnu sort and gawk +* Before update from former adblock releases please make a backup of your local allow- and blocklists. In the latest adblock 4.4.x these lists have been renamed to '/etc/adblock/adblock.allowlist' and '/etc/adblock/adblock.blocklist'. There is no automatic content transition to the new files. +* The uci configuration of adblock is automatically migrated during package installation via the uci-defaults mechanism using a housekeeping script ## Installation & Usage -* Update your local opkg/apk repository +* Make a backup and update your local opkg/apk repository * Install the LuCI companion package 'luci-app-adblock' which also installs the main 'adblock' package as a dependency * 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 at least a 'Startup Trigger Interface' to depend on WAN ifup events during boot or restart of your router +* It is also strongly recommended to configure a ‘Startup Trigger Interface’ to ensure automatic adblock startup on WAN-ifup events during boot or reboot of your router ## Adblock CLI interface @@ -260,12 +262,18 @@ password xxx Finally enable E-Mail support and add a valid E-Mail receiver address in LuCI. -**Send status E-Mails and update the adblock lists via cron job** -For a regular, automatic status mailing and update of the used lists on a daily basis set up a cron job, e.g. +**Automatic feed updates and status reports via E-Mail** +For a regular, automatic update of the used feeds or other regular adblock activities set up a cron job, e.g.: ``` -55 03 * * * /etc/init.d/adblock report mail +# update the feeds every morning at 4 o'clock 00 04 * * * /etc/init.d/adblock reload + +# send a report E-Mail every morning at 3 o'clock +00 03 * * * /etc/init.d/adblock report mail + +# update the feeds every hour +0 */1 * * * /etc/init.d/adblock reload ``` **Service status output:** @@ -289,7 +297,7 @@ To get the status in the CLI, just call _/etc/init.d/adblock status_ or _/etc/in ``` **Change/add adblock feeds** -The adblock default blocklist feeds are stored in an external JSON file '/etc/adblock/adblock.feeds'. All custom changes should be stored in an external JSON file '/etc/adblock/adblock.custom.feeds' (empty by default). It's recommended to use the LuCI based Custom Feed Editor to make changes to this file. +The adblock blocklist feeds are stored in an external JSON file '/etc/adblock/adblock.feeds'. All custom changes should be stored in an external JSON file '/etc/adblock/adblock.custom.feeds' (empty by default). It's recommended to use the LuCI based Custom Feed Editor to make changes to this file. A valid JSON source object contains the following information, e.g.: ```