From 7d16d2112f902679cf0f80d7c3f71c54babf04c2 Mon Sep 17 00:00:00 2001 From: mango Date: Fri, 17 Apr 2026 00:24:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=97=A5=E5=BF=97=E5=92=8C=20Arch=20Linux=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/stream-unlock.sh | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/scripts/stream-unlock.sh b/scripts/stream-unlock.sh index 8826d9b..7be3868 100644 --- a/scripts/stream-unlock.sh +++ b/scripts/stream-unlock.sh @@ -88,10 +88,27 @@ detect_os() { elif [[ -f /etc/redhat-release ]]; then OS="centos" PKG_MANAGER="yum" + elif [[ -f /etc/arch-release ]]; then + OS="arch" + PKG_MANAGER="pacman" else - echo -e "${RED}不支持的系统${NC}" - exit 1 + # 尝试检测其他系统 + if command -v apt &>/dev/null; then + OS="debian" + PKG_MANAGER="apt" + elif command -v yum &>/dev/null; then + OS="centos" + PKG_MANAGER="yum" + elif command -v pacman &>/dev/null; then + OS="arch" + PKG_MANAGER="pacman" + else + echo -e "${RED}不支持的系统,请手动安装 sniproxy${NC}" + echo -e "${YELLOW}支持的系统: Debian/Ubuntu, CentOS/RHEL, Arch Linux${NC}" + exit 1 + fi fi + echo -e "${GREEN}检测到系统: $OS${NC}" } get_public_ip() { @@ -106,14 +123,21 @@ get_public_ip() { install_sniproxy() { echo -e "${GREEN}[解锁机] 安装 sniproxy...${NC}" + echo -e "${YELLOW}系统类型: $OS${NC}" # 安装依赖 if [[ "$OS" == "debian" ]]; then apt update apt install -y sniproxy dnsmasq ufw - else + elif [[ "$OS" == "centos" ]]; then yum install -y epel-release yum install -y sniproxy dnsmasq firewalld + elif [[ "$OS" == "arch" ]]; then + pacman -Sy --noconfirm sniproxy dnsmasq ufw + else + echo -e "${RED}不支持的系统: $OS${NC}" + echo -e "${YELLOW}请手动安装 sniproxy 和 dnsmasq${NC}" + return 1 fi # 备份原配置