From d89ff773284fce65bd71ad96e184495ff95446fa Mon Sep 17 00:00:00 2001 From: lean Date: Fri, 13 Mar 2020 19:20:14 +0800 Subject: [PATCH] luci-app-adbyby-plus: rules always copy to ram --- package/lean/luci-app-adbyby-plus/Makefile | 2 +- .../luasrc/controller/adbyby.lua | 4 ++-- .../luci-app-adbyby-plus/root/etc/init.d/adbyby | 14 +++++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package/lean/luci-app-adbyby-plus/Makefile b/package/lean/luci-app-adbyby-plus/Makefile index d4be8ef2a1..80672931e7 100644 --- a/package/lean/luci-app-adbyby-plus/Makefile +++ b/package/lean/luci-app-adbyby-plus/Makefile @@ -10,7 +10,7 @@ LUCI_DEPENDS:=+adbyby +wget +ipset +dnsmasq-full LUCI_PKGARCH:=all PKG_NAME:=luci-app-adbyby-plus PKG_VERSION:=2.0 -PKG_RELEASE:=65 +PKG_RELEASE:=66 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua b/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua index e067ad84cb..bdf7b408d1 100644 --- a/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua +++ b/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua @@ -48,7 +48,7 @@ luci.sys.exec("/usr/share/adbyby/rule-update") if tonumber(icount) ~= tonumber(oldcount) then luci.sys.exec("rm -f /usr/share/adbyby/rules/data/* /usr/share/adbyby/rules/host/* && cp -a /tmp/rules /usr/share/adbyby/") - luci.sys.exec("/etc/init.d/dnsmasq reload") + luci.sys.exec("/etc/init.d/adbyby restart &") retstring=tostring(math.ceil(tonumber(icount))) else retstring ="0" @@ -68,7 +68,7 @@ if sret== 0 then if tonumber(icount) ~= tonumber(oldcount) then luci.sys.exec("cp -f /tmp/ad.conf /usr/share/adbyby/dnsmasq.adblock") luci.sys.exec("cp -f /tmp/ad.conf /tmp/etc/dnsmasq-adbyby.d/adblock") - luci.sys.exec("/etc/init.d/dnsmasq reload") + luci.sys.exec("/etc/init.d/adbyby restart &") retstring=tostring(math.ceil(tonumber(icount))) else retstring ="0" diff --git a/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby b/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby index b128bbf2c6..275c77424c 100755 --- a/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby +++ b/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby @@ -109,11 +109,8 @@ add_dns() awk '!/^$/&&!/^#/{printf("ipset=/%s/'"adbyby_esc"'\n",$0)}' $PROG_PATH/adesc.conf > /var/etc/dnsmasq-adbyby.d/06-dnsmasq.esc awk '!/^$/&&!/^#/{printf("address=/%s/'"0.0.0.0"'\n",$0)}' $PROG_PATH/adblack.conf > /var/etc/dnsmasq-adbyby.d/07-dnsmasq.black - cat > /tmp/dnsmasq.d/dnsmasq-adbyby.conf < /tmp/dnsmasq.d/dnsmasq-adbyby.conf local var=1 if [ $wan_mode -eq 1 ]; then @@ -125,6 +122,13 @@ EOF fi fi + mkdir -p /tmp/adbyby/rules/data mkdir -p /tmp/adbyby/rules/host + rm -f /tmp/adbyby/rules/data/* /tmp/adbyby/rules/host/* + cp -a /usr/share/adbyby/rules/data/* /tmp/adbyby/rules/data 2>/dev/null + cp -a /usr/share/adbyby/rules/host/* /tmp/adbyby/rules/host 2>/dev/null + echo 'addn-hosts=/tmp/adbyby/rules/host/' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf + echo 'conf-dir=/tmp/adbyby/rules/data' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf + [ $block_ios -eq 1 ] && echo 'address=/mesu.apple.com/0.0.0.0' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf }