adblock-fast: bugfix: dnsmasq instances confdir hack
authorStan Grishin <stangri@melmac.ca>
Fri, 6 Dec 2024 03:10:17 +0000 (03:10 +0000)
committerStan Grishin <stangri@melmac.ca>
Sat, 7 Dec 2024 01:50:38 +0000 (17:50 -0800)
* temporary hack until https://github.com/openwrt/openwrt/pull/16806 is merged

Signed-off-by: Stan Grishin <stangri@melmac.ca>
net/adblock-fast/Makefile
net/adblock-fast/files/etc/init.d/adblock-fast

index 34ba798be952890ef2463098f08e6b2e620a1134..a70f211aba69f2a33bdbac052a7a9acfaed14c2e 100644 (file)
@@ -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 <stangri@melmac.ca>
 PKG_LICENSE:=AGPL-3.0-or-later
 
index 0af3f3d24964ce76283ef8e3cda5a5b23c6d8eab..81bca4e0b08ce34d6301c3c4f5db9bd068ccc97b 100755 (executable)
@@ -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}"