From b00766ad459a6b0999b9dd5926abdf9cb9786976 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Mon, 10 Feb 2025 14:42:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E5=A4=8DAl?= =?UTF-8?q?pine=E8=87=AA=E5=90=AF=E5=8A=A8=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 58 ++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/install.sh b/install.sh index 513352c..36a7557 100644 --- a/install.sh +++ b/install.sh @@ -1135,10 +1135,12 @@ installTools() { if ! find /usr/bin /usr/sbin | grep -q -w dig; then echoContent green " ---> 安装dig" - if echo "${installType}" | grep -q -w "apt"; then + if echo "${installType}" | grep -qw "apt"; then ${installType} dnsutils >/dev/null 2>&1 - elif echo "${installType}" | grep -qwE "yum|apk"; then + elif echo "${installType}" | grep -qw "yum"; then ${installType} bind-utils >/dev/null 2>&1 + elif echo "${installType}" | grep -qw "apk"; then + ${installType} bind-tools >/dev/null 2>&1 fi fi @@ -2725,32 +2727,28 @@ EOF # 安装alpine开机启动 installAlpineStartup() { local serviceName=$1 - local startCommand=$2 + if [[ "${serviceName}" == "sing-box" ]]; then + cat <"/etc/init.d/${serviceName}" +#!/sbin/openrc-run - cat <"/etc/init.d/${serviceName}" -#!/bin/sh - -case "\$1" in - start) - echo "Starting ${serviceName}" - ${startCommand} >/dev/null 2>&1 & - ;; - stop) - echo "Stopping ${serviceName}" - pgrep -f ${serviceName}|xargs kill -9 >/dev/null 2>&1 - ;; - restart) - rc-service ${serviceName} stop - rc-service ${serviceName} start - ;; - *) - echo "Usage: rc-service ${serviceName} {start|stop|restart}" - exit 1 - ;; -esac - -exit 0 +description="sing-box service" +command="/etc/v2ray-agent/sing-box/sing-box" +command_args="run -c /etc/v2ray-agent/sing-box/conf/config.json" +command_background=true +pidfile="/var/run/sing-box.pid" EOF + elif [[ "${serviceName}" == "xray" ]]; then + cat <"/etc/init.d/${serviceName}" +#!/sbin/openrc-run + +description="xray service" +command="/etc/v2ray-agent/xray/xray" +command_args="run -confdir /etc/v2ray-agent/xray/conf" +command_background=true +pidfile="/var/run/xray.pid" +EOF + fi + chmod +x "/etc/init.d/${serviceName}" } @@ -2785,7 +2783,7 @@ WantedBy=multi-user.target EOF bootStartup "sing-box.service" elif [[ "${release}" == "alpine" ]]; then - installAlpineStartup "sing-box" "${execStart}" + installAlpineStartup "sing-box" bootStartup "sing-box" fi @@ -2817,7 +2815,7 @@ EOF bootStartup "xray.service" echoContent green " ---> 配置Xray开机自启成功" elif [[ "${release}" == "alpine" ]]; then - installAlpineStartup "xray" "${execStart}" + installAlpineStartup "xray" bootStartup "xray" fi } @@ -4671,7 +4669,7 @@ EOF echoContent skyBlue "\n开始配置VMess+ws协议端口" echo mapfile -t result < <(initSingBoxPort "${singBoxVMessWSPort}") - echoContent green "\n ---> VLESS_Vision端口:${result[-1]}" + echoContent green "\n ---> VMess_ws端口:${result[-1]}" checkDNSIP "${domain}" removeNginxDefaultConf @@ -9748,7 +9746,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v3.4.2" + echoContent green "当前版本:v3.4.3" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus