From a6aa2ff602efb5f617e0a4b8b78c947377e63614 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Sun, 22 Dec 2024 17:00:20 +0800 Subject: [PATCH] luci-app-passwall2: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall2/commit/d38484519a11df311d403e2001e7621722ec26ae --- luci-app-passwall2/luasrc/passwall2/api.lua | 2 +- luci-app-passwall2/root/usr/share/passwall2/app.sh | 6 +++++- .../root/usr/share/passwall2/helper_dnsmasq.lua | 8 ++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/luci-app-passwall2/luasrc/passwall2/api.lua b/luci-app-passwall2/luasrc/passwall2/api.lua index a5939ed7f..976f2a3ea 100644 --- a/luci-app-passwall2/luasrc/passwall2/api.lua +++ b/luci-app-passwall2/luasrc/passwall2/api.lua @@ -220,7 +220,7 @@ function is_install(package) local file_path = "/usr/lib/opkg/info" local file_ext = ".control" local has = sys.call("[ -d " .. file_path .. " ]") - if has == 0 then + if has ~= 0 then file_path = "/lib/apk/packages" file_ext = ".list" end diff --git a/luci-app-passwall2/root/usr/share/passwall2/app.sh b/luci-app-passwall2/root/usr/share/passwall2/app.sh index f2531161a..c5eae2fb9 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -797,6 +797,8 @@ run_global() { -DEFAULT_DNS ${AUTO_DNS} -LOCAL_DNS ${LOCAL_DNS:-${AUTO_DNS}} -TUN_DNS ${TUN_DNS} \ -NFTFLAG ${nftflag:-0} \ -NO_LOGIC_LOG ${NO_LOGIC_LOG:-0} + uci -q add_list dhcp.@dnsmasq[0].addnmount=${GLOBAL_DNSMASQ_CONF_PATH} + uci -q commit dhcp lua $APP_PATH/helper_dnsmasq.lua logic_restart -LOG 1 else #Run a copy dnsmasq instance, DNS hijack for that need proxy devices. @@ -1234,7 +1236,7 @@ start() { USE_TABLES="nftables" nftflag=1 config_t_set global_forwarding use_nft 1 - uci commit ${CONFIG} + uci -q commit ${CONFIG} fi fi else @@ -1302,6 +1304,8 @@ stop() { uci -q commit ${CONFIG} } if [ -z "$(get_cache_var "ACL_default_dns_port")" ] || [ -n "${bak_dnsmasq_dns_redirect}" ]; then + uci -q del_list dhcp.@dnsmasq[0].addnmount="${GLOBAL_DNSMASQ_CONF_PATH}" + uci -q commit dhcp lua $APP_PATH/helper_dnsmasq.lua restart -LOG 0 fi bak_bridge_nf_ipt=$(get_cache_var "bak_bridge_nf_ipt") diff --git a/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua b/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua index 95ccebdc9..731b94889 100644 --- a/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua +++ b/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua @@ -314,12 +314,8 @@ function add_rule(var) f_out:close() end - if api.is_install("procd\\-ujail") then - fs.copyr(CACHE_DNS_PATH, TMP_DNSMASQ_PATH) - else - api.remove(TMP_DNSMASQ_PATH) - fs.symlink(CACHE_DNS_PATH, TMP_DNSMASQ_PATH) - end + api.remove(TMP_DNSMASQ_PATH) + fs.symlink(CACHE_DNS_PATH, TMP_DNSMASQ_PATH) if DNSMASQ_CONF_FILE ~= "nil" then local conf_lines = {}