diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index f6e299ec0..93388ce5e 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -17,13 +17,13 @@ LOCK_FILE=/var/lock/ssrplus.lock LOG_FILE=/var/log/ssrplus.log TMP_PATH=/var/etc/ssrplus TMP_BIN_PATH=$TMP_PATH/bin -# Get the default DNSMasq config ID from the UCI configuration +# 获取默认的 DNSMasq 配置 ID DEFAULT_DNSMASQ_CFGID=$(uci show dhcp.@dnsmasq[0] | awk -F '.' '{print $2}' | awk -F '=' '{print $1}' | head -1) -# Locate the dnsmasq.conf file that contains the conf-dir option +# 查找包含 conf-dir 选项的 dnsmasq.conf 文件路径 DNSMASQ_CONF_PATH=$(grep -l "^conf-dir=" "/tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID}") -# Extract the directory path from the conf-dir line +# 从 conf-dir 行中提取目录路径 DNSMASQ_CONF_DIR=$(grep '^conf-dir=' "$DNSMASQ_CONF_PATH" | cut -d'=' -f2 | head -n 1) -# Check if a conf-dir value was found and set variables accordingly +# 设置 TMP_DNSMASQ_PATH,并去除路径末尾的斜杠 TMP_DNSMASQ_PATH=${DNSMASQ_CONF_DIR%*/}/dnsmasq-ssrplus.d chain_config_file= #generate shadowtls chain proxy config file diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua index 70bf2249c..8572f24aa 100755 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua @@ -9,8 +9,7 @@ require "luci.model.uci" local icount = 0 local args = arg[1] local uci = luci.model.uci.cursor() -local TMP_DNSMASQ_PATH = "${DNSMASQ_CONF_DIR%*/}/dnsmasq-ssrplus.d" -luci.sys.call("mkdir -p " .. TMP_DNSMASQ_PATH) +local TMP_DNSMASQ_PATH = luci.sys.exec("find /tmp/dnsmasq.*/dnsmasq-ssrplus.d -print 2>/dev/null | head -n 1"):gsub("%s+", "") local TMP_PATH = "/var/etc/ssrplus" -- match comments/title/whitelist/ip address/excluded_domain local comment_pattern = "^[!\\[@]+" diff --git a/patch-luci-app-ssr-plus.patch b/patch-luci-app-ssr-plus.patch index 5625290f0..d30e94403 100644 --- a/patch-luci-app-ssr-plus.patch +++ b/patch-luci-app-ssr-plus.patch @@ -462,7 +462,7 @@ index da30ffc..f97309b 100644 msgstr "DNS 服务器 IP:Port" diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr -index 231dccc..f6e299e 100755 +index 4029a07..93388ce 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -185,23 +185,17 @@ ln_start_bin() {