fix(脚本): 修复核心下载失败问题

pull/965/head
mack-a 2024-02-27 17:26:05 +08:00
parent 1aadfa4182
commit cf81321e42
1 changed files with 32 additions and 24 deletions

View File

@ -2028,20 +2028,26 @@ installSingBox() {
readInstallType readInstallType
echoContent skyBlue "\n进度 $1/${totalProgress} : 安装sing-box" 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) 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}" 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" 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 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 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-* rm -rf /etc/v2ray-agent/sing-box/sing-box-*
chmod 655 /etc/v2ray-agent/sing-box/sing-box chmod 655 /etc/v2ray-agent/sing-box/sing-box
fi
else else
echoContent green " ---> sing-box版本:v$(/etc/v2ray-agent/sing-box/sing-box version | grep "sing-box version" | awk '{print $3}')" 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 read -r -p "是否更新、升级?[y/n]:" reInstallSingBoxStatus
@ -2069,7 +2075,7 @@ installXray() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 安装Xray" 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) 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,10 +2083,11 @@ installXray() {
wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" 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 if [[ ! -f "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" ]]; then
echoContent red " ---> 核心下载失败,请重新尝试安装" read -r -p "核心下载失败,请重新尝试安装,是否重新尝试?[y/n]" downloadStatus
exit 0 if [[ "${downloadStatus}" == "y" ]]; then
installXray "$1"
fi fi
else
unzip -o "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" -d /etc/v2ray-agent/xray >/dev/null unzip -o "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" -d /etc/v2ray-agent/xray >/dev/null
rm -rf "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" rm -rf "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip"
@ -2093,6 +2100,7 @@ installXray() {
wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/xray/ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geoip.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 chmod 655 /etc/v2ray-agent/xray/xray
fi
else else
echoContent green " ---> Xray-core版本:$(/etc/v2ray-agent/xray/xray --version | awk '{print $2}' | head -1)" echoContent green " ---> Xray-core版本:$(/etc/v2ray-agent/xray/xray --version | awk '{print $2}' | head -1)"
read -r -p "是否更新、升级?[y/n]:" reInstallXrayStatus read -r -p "是否更新、升级?[y/n]:" reInstallXrayStatus
@ -7546,7 +7554,7 @@ unInstallXrayCoreReality() {
coreVersionManageMenu() { coreVersionManageMenu() {
if [[ -z "${coreInstallType}" ]]; then if [[ -z "${coreInstallType}" ]]; then
echoContent red "\n ---> >没有检测到安装目录,请执行脚本安装内容" echoContent red "\n ---> 没有检测到安装目录,请执行脚本安装内容"
menu menu
exit 0 exit 0
fi fi
@ -8735,7 +8743,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.2.11" echoContent green "当前版本v3.2.12"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus