mirror of https://github.com/mack-a/v2ray-agent
fix(脚本): 修复Alpine自启动、修改端口显示
parent
dfb9b4e5b5
commit
b00766ad45
58
install.sh
58
install.sh
|
@ -1135,10 +1135,12 @@ installTools() {
|
||||||
|
|
||||||
if ! find /usr/bin /usr/sbin | grep -q -w dig; then
|
if ! find /usr/bin /usr/sbin | grep -q -w dig; then
|
||||||
echoContent green " ---> 安装dig"
|
echoContent green " ---> 安装dig"
|
||||||
if echo "${installType}" | grep -q -w "apt"; then
|
if echo "${installType}" | grep -qw "apt"; then
|
||||||
${installType} dnsutils >/dev/null 2>&1
|
${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
|
${installType} bind-utils >/dev/null 2>&1
|
||||||
|
elif echo "${installType}" | grep -qw "apk"; then
|
||||||
|
${installType} bind-tools >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2725,32 +2727,28 @@ EOF
|
||||||
# 安装alpine开机启动
|
# 安装alpine开机启动
|
||||||
installAlpineStartup() {
|
installAlpineStartup() {
|
||||||
local serviceName=$1
|
local serviceName=$1
|
||||||
local startCommand=$2
|
if [[ "${serviceName}" == "sing-box" ]]; then
|
||||||
|
cat <<EOF >"/etc/init.d/${serviceName}"
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
cat <<EOF >"/etc/init.d/${serviceName}"
|
description="sing-box service"
|
||||||
#!/bin/sh
|
command="/etc/v2ray-agent/sing-box/sing-box"
|
||||||
|
command_args="run -c /etc/v2ray-agent/sing-box/conf/config.json"
|
||||||
case "\$1" in
|
command_background=true
|
||||||
start)
|
pidfile="/var/run/sing-box.pid"
|
||||||
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
|
|
||||||
EOF
|
EOF
|
||||||
|
elif [[ "${serviceName}" == "xray" ]]; then
|
||||||
|
cat <<EOF >"/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}"
|
chmod +x "/etc/init.d/${serviceName}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2785,7 +2783,7 @@ WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
bootStartup "sing-box.service"
|
bootStartup "sing-box.service"
|
||||||
elif [[ "${release}" == "alpine" ]]; then
|
elif [[ "${release}" == "alpine" ]]; then
|
||||||
installAlpineStartup "sing-box" "${execStart}"
|
installAlpineStartup "sing-box"
|
||||||
bootStartup "sing-box"
|
bootStartup "sing-box"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2817,7 +2815,7 @@ EOF
|
||||||
bootStartup "xray.service"
|
bootStartup "xray.service"
|
||||||
echoContent green " ---> 配置Xray开机自启成功"
|
echoContent green " ---> 配置Xray开机自启成功"
|
||||||
elif [[ "${release}" == "alpine" ]]; then
|
elif [[ "${release}" == "alpine" ]]; then
|
||||||
installAlpineStartup "xray" "${execStart}"
|
installAlpineStartup "xray"
|
||||||
bootStartup "xray"
|
bootStartup "xray"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -4671,7 +4669,7 @@ EOF
|
||||||
echoContent skyBlue "\n开始配置VMess+ws协议端口"
|
echoContent skyBlue "\n开始配置VMess+ws协议端口"
|
||||||
echo
|
echo
|
||||||
mapfile -t result < <(initSingBoxPort "${singBoxVMessWSPort}")
|
mapfile -t result < <(initSingBoxPort "${singBoxVMessWSPort}")
|
||||||
echoContent green "\n ---> VLESS_Vision端口:${result[-1]}"
|
echoContent green "\n ---> VMess_ws端口:${result[-1]}"
|
||||||
|
|
||||||
checkDNSIP "${domain}"
|
checkDNSIP "${domain}"
|
||||||
removeNginxDefaultConf
|
removeNginxDefaultConf
|
||||||
|
@ -9748,7 +9746,7 @@ menu() {
|
||||||
cd "$HOME" || exit
|
cd "$HOME" || exit
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent green "作者:mack-a"
|
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 "Github:https://github.com/mack-a/v2ray-agent"
|
||||||
echoContent green "描述:八合一共存脚本\c"
|
echoContent green "描述:八合一共存脚本\c"
|
||||||
showInstallStatus
|
showInstallStatus
|
||||||
|
|
Loading…
Reference in New Issue