From cf81321e42483df98093e23ad8edcf77ef1f0a7b Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:26:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=8B=E8=BD=BD=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 56 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/install.sh b/install.sh index da6816a..6d47aba 100644 --- a/install.sh +++ b/install.sh @@ -2028,20 +2028,26 @@ installSingBox() { readInstallType echoContent skyBlue "\n进度 $1/${totalProgress} : 安装sing-box" - if [[ -z "${singBoxConfigPath}" ]]; then + if [[ ! -f "/etc/v2ray-agent/sing-box/sing-box" ]]; then version=$(curl -s "https://api.github.com/repos/SagerNet/sing-box/releases?per_page=20" | jq -r ".[]|select (.prerelease==${prereleaseStatus})|.tag_name" | head -1) echoContent green " ---> sing-box版本:${version}" wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/sing-box/ "https://github.com/SagerNet/sing-box/releases/download/${version}/sing-box-${version/v/}${singBoxCoreCPUVendor}.tar.gz" + if [[ ! -f "/etc/v2ray-agent/sing-box/sing-box-${version/v/}${singBoxCoreCPUVendor}.tar.gz" ]]; then + read -r -p "核心下载失败,请重新尝试安装,是否重新尝试?[y/n]" downloadStatus + if [[ "${downloadStatus}" == "y" ]]; then + installSingBox "$1" + fi + else - tar zxvf "/etc/v2ray-agent/sing-box/sing-box-${version/v/}${singBoxCoreCPUVendor}.tar.gz" -C "/etc/v2ray-agent/sing-box/" >/dev/null 2>&1 - - mv "/etc/v2ray-agent/sing-box/sing-box-${version/v/}${singBoxCoreCPUVendor}/sing-box" /etc/v2ray-agent/sing-box/sing-box - rm -rf /etc/v2ray-agent/sing-box/sing-box-* - chmod 655 /etc/v2ray-agent/sing-box/sing-box + tar zxvf "/etc/v2ray-agent/sing-box/sing-box-${version/v/}${singBoxCoreCPUVendor}.tar.gz" -C "/etc/v2ray-agent/sing-box/" >/dev/null 2>&1 + mv "/etc/v2ray-agent/sing-box/sing-box-${version/v/}${singBoxCoreCPUVendor}/sing-box" /etc/v2ray-agent/sing-box/sing-box + rm -rf /etc/v2ray-agent/sing-box/sing-box-* + chmod 655 /etc/v2ray-agent/sing-box/sing-box + fi else echoContent green " ---> sing-box版本:v$(/etc/v2ray-agent/sing-box/sing-box version | grep "sing-box version" | awk '{print $3}')" read -r -p "是否更新、升级?[y/n]:" reInstallSingBoxStatus @@ -2069,7 +2075,7 @@ installXray() { echoContent skyBlue "\n进度 $1/${totalProgress} : 安装Xray" - if [[ "${coreInstallType}" != "1" ]]; then + if [[ ! -f "/etc/v2ray-agent/xray/xray" ]]; then version=$(curl -s "https://api.github.com/repos/XTLS/Xray-core/releases?per_page=5" | jq -r ".[]|select (.prerelease==${prereleaseStatus})|.tag_name" | head -1) @@ -2077,22 +2083,24 @@ installXray() { wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" if [[ ! -f "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" ]]; then - echoContent red " ---> 核心下载失败,请重新尝试安装" - exit 0 + read -r -p "核心下载失败,请重新尝试安装,是否重新尝试?[y/n]" downloadStatus + if [[ "${downloadStatus}" == "y" ]]; then + installXray "$1" + fi + else + unzip -o "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" -d /etc/v2ray-agent/xray >/dev/null + rm -rf "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" + + version=$(curl -s https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases?per_page=1 | jq -r '.[]|.tag_name') + echoContent skyBlue "------------------------Version-------------------------------" + echo "version:${version}" + rm /etc/v2ray-agent/xray/geo* >/dev/null 2>&1 + + wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/xray/ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geosite.dat" + wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/xray/ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geoip.dat" + + chmod 655 /etc/v2ray-agent/xray/xray fi - - unzip -o "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" -d /etc/v2ray-agent/xray >/dev/null - rm -rf "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" - - version=$(curl -s https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases?per_page=1 | jq -r '.[]|.tag_name') - echoContent skyBlue "------------------------Version-------------------------------" - echo "version:${version}" - rm /etc/v2ray-agent/xray/geo* >/dev/null 2>&1 - - wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/xray/ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geosite.dat" - wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/xray/ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geoip.dat" - - chmod 655 /etc/v2ray-agent/xray/xray else echoContent green " ---> Xray-core版本:$(/etc/v2ray-agent/xray/xray --version | awk '{print $2}' | head -1)" read -r -p "是否更新、升级?[y/n]:" reInstallXrayStatus @@ -7546,7 +7554,7 @@ unInstallXrayCoreReality() { coreVersionManageMenu() { if [[ -z "${coreInstallType}" ]]; then - echoContent red "\n ---> >没有检测到安装目录,请执行脚本安装内容" + echoContent red "\n ---> 没有检测到安装目录,请执行脚本安装内容" menu exit 0 fi @@ -8735,7 +8743,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v3.2.11" + echoContent green "当前版本:v3.2.12" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus