From 775028a35aae4fcfb2aba3dc2a9413e491cb9c48 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Fri, 8 Aug 2025 20:48:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E5=BC=80=E6=94=BE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/install.sh b/install.sh index 980d64d..f63513c 100644 --- a/install.sh +++ b/install.sh @@ -699,24 +699,7 @@ allowPort() { type=tcp fi # 如果防火墙启动状态则添加相应的开放端口 - if systemctl status netfilter-persistent 2>/dev/null | grep -q "active (exited)"; then - local updateFirewalldStatus= - if ! iptables -L | grep -q "$1/${type}(mack-a)"; then - updateFirewalldStatus=true - iptables -I INPUT -p ${type} --dport "$1" -m comment --comment "allow $1/${type}(mack-a)" -j ACCEPT - fi - - if echo "${updateFirewalldStatus}" | grep -q "true"; then - netfilter-persistent save - fi - elif systemctl status ufw 2>/dev/null | grep -q "active (exited)"; then - if ufw status | grep -q "Status: active"; then - if ! ufw status | grep -q "$1/${type}"; then - sudo ufw allow "$1/${type}" - checkUFWAllowPort "$1" - fi - fi - elif rc-update show 2>/dev/null | grep -q ufw; then + if systemctl status ufw 2>/dev/null | grep -q "active (exited)"; then if ufw status | grep -q "Status: active"; then if ! ufw status | grep -q "$1/${type}"; then sudo ufw allow "$1/${type}" @@ -738,6 +721,23 @@ allowPort() { if echo "${updateFirewalldStatus}" | grep -q "true"; then firewall-cmd --reload fi + elif rc-update show 2>/dev/null | grep -q ufw; then + if ufw status | grep -q "Status: active"; then + if ! ufw status | grep -q "$1/${type}"; then + sudo ufw allow "$1/${type}" + checkUFWAllowPort "$1" + fi + fi + elif systemctl status netfilter-persistent 2>/dev/null | grep -q "active (exited)"; then + local updateFirewalldStatus= + if ! iptables -L | grep -q "$1/${type}(mack-a)"; then + updateFirewalldStatus=true + iptables -I INPUT -p ${type} --dport "$1" -m comment --comment "allow $1/${type}(mack-a)" -j ACCEPT + fi + + if echo "${updateFirewalldStatus}" | grep -q "true"; then + netfilter-persistent save + fi fi } # 获取公网IP @@ -9931,7 +9931,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v3.4.19" + echoContent green "当前版本:v3.4.20" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus