From beebdba29e4ba8c9ee34bf30f331f65162a72eb8 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Fri, 6 Dec 2024 03:10:17 +0000 Subject: [PATCH] adblock-fast: bugfix: dnsmasq instances confdir hack * temporary hack until https://github.com/openwrt/openwrt/pull/16806 is merged Signed-off-by: Stan Grishin --- net/adblock-fast/Makefile | 2 +- net/adblock-fast/files/etc/init.d/adblock-fast | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/net/adblock-fast/Makefile b/net/adblock-fast/Makefile index 34ba798be9..a70f211aba 100644 --- a/net/adblock-fast/Makefile +++ b/net/adblock-fast/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock-fast PKG_VERSION:=1.1.2 -PKG_RELEASE:=16 +PKG_RELEASE:=18 PKG_MAINTAINER:=Stan Grishin PKG_LICENSE:=AGPL-3.0-or-later diff --git a/net/adblock-fast/files/etc/init.d/adblock-fast b/net/adblock-fast/files/etc/init.d/adblock-fast index 0af3f3d249..81bca4e0b0 100755 --- a/net/adblock-fast/files/etc/init.d/adblock-fast +++ b/net/adblock-fast/files/etc/init.d/adblock-fast @@ -854,7 +854,12 @@ resolver() { uci_add_list_if_new 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile" ;; cleanup|unbound.adb_list) - config_get confdir "$cfg" 'confdir' '/tmp/dnsmasq.d' +# shellcheck disable=SC2016 + if grep -q 'config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq${cfg:+.$cfg}.d"' '/etc/init.d/dnsmasq'; then + config_get confdir "$cfg" 'confdir' "/tmp/dnsmasq${cfg:+.$cfg}.d" + else + config_get confdir "$cfg" 'confdir' '/tmp/dnsmasq.d' + fi rm -f "${confdir}/${dnsmasqConfFile}" "${confdir}/${dnsmasqIpsetFile}" "${confdir}/${dnsmasqNftsetFile}" uci_remove_list 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile" if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" = "$dnsmasqServersFile" ]; then @@ -875,13 +880,17 @@ resolver() { ;; esac } -# shellcheck disable=SC2317 +# shellcheck disable=SC2016,SC2317 _dnsmasq_instance_init() { local cfg="$1" param="$2" confdir confdirFile [ -s "/etc/config/dhcp" ] || return 0 case "$param" in dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset) - config_get confdir "$cfg" 'confdir' '/tmp/dnsmasq.d' + if grep -q 'config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq${cfg:+.$cfg}.d"' '/etc/init.d/dnsmasq'; then + config_get confdir "$cfg" 'confdir' "/tmp/dnsmasq${cfg:+.$cfg}.d" + else + config_get confdir "$cfg" 'confdir' '/tmp/dnsmasq.d' + fi confdirFile="${confdir}/${outputFile}" if ! str_contains "$outputDnsmasqFileList" "$confdirFile"; then outputDnsmasqFileList="${outputDnsmasqFileList:+$outputDnsmasqFileList }${confdirFile}" -- 2.30.2