From 41821e23c738e9ca6ae2dbbf1ddae0ad5130255b Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Fri, 19 Oct 2018 19:26:20 +0800 Subject: [PATCH] let adbyby plus can autoupdate rules in dhcp client network environment for XueMao --- package/lean/luci-app-adbyby-plus/Makefile | 2 +- .../luci-app-adbyby-plus/root/etc/init.d/adbyby | 13 +++++++++++++ .../root/usr/share/adbyby/adupdate.sh | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package/lean/luci-app-adbyby-plus/Makefile b/package/lean/luci-app-adbyby-plus/Makefile index 5e5f006c3..c21b76dd2 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 +coreutils +coreutils-nohup +dnsmasq-full LUCI_PKGARCH:=all PKG_NAME:=luci-app-adbyby-plus PKG_VERSION:=2.0 -PKG_RELEASE:=32 +PKG_RELEASE:=33 include $(TOPDIR)/feeds/luci/luci.mk 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 47147cee9..7e4dfd739 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 @@ -172,7 +172,20 @@ start() [ ! -d "/tmp/adbyby" ] && mkdir -p /tmp/adbyby && cp -a $PROG_PATH/data /tmp/adbyby/ mount --bind /tmp/adbyby/data $PROG_PATH/data fi + touch /tmp/adbyby.mem + wget_ok="0" + while [ "$wget_ok" = "0" ] + do + wget-ssl --spider --quiet --tries=1 --timeout=3 www.baidu.com + if [ "$?" == "0" ]; then + wget_ok="1" + /usr/share/adbyby/adupdate.sh + else + sleep 10 + fi + done fi + rm -f /tmp/adbyby.mem echo "add adbyby rules" add_rules $PROG_PATH/adbyby &>/dev/null & diff --git a/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/adupdate.sh b/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/adupdate.sh index 0b8b617e6..63f75c36a 100755 --- a/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/adupdate.sh +++ b/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/adupdate.sh @@ -21,4 +21,4 @@ fi rm -f /tmp/lazy.txt /tmp/video.txt /tmp/user.action -/etc/init.d/adbyby restart +[ ! -f "/tmp/adbyby.mem" ] && /etc/init.d/adbyby restart