Skip to content

Commit 2e26496

Browse files
authored
Merge pull request #8 from raidenii/main
adblock-fast: fix jsonfilter parsing dnsmasq instance name
2 parents 116e922 + f944600 commit 2e26496

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

files/etc/init.d/adblock-fast

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,11 @@ load_environment() {
10681068
resolver() {
10691069
_dnsmasq_instance_get_confdir() {
10701070
local cfg_file
1071+
local instance_name
1072+
1073+
instance_name=$(uci -q show "dhcp.${1}" | awk -F'[.=]' 'NR==1{print $2}')
10711074
[ -z "$dnsmasq_ubus" ] && dnsmasq_ubus="$(ubus call service list '{"name":"dnsmasq"}')"
1072-
cfg_file="$(echo "$dnsmasq_ubus" | jsonfilter -e "@.dnsmasq.instances.${1}.command" \
1075+
cfg_file="$(echo "$dnsmasq_ubus" | jsonfilter -e "@.dnsmasq.instances.${instance_name}.command" \
10731076
| awk '{gsub(/\\\//,"/");gsub(/[][",]/,"");for(i=1;i<=NF;i++)if($i=="-C"){print $(i+1);exit}}')"
10741077
awk -F= '/^conf-dir=/{print $2; exit}' "$cfg_file"
10751078
}

0 commit comments

Comments
 (0)