Skip to content

Commit

Permalink
fix(脚本): 修复核心下载失败问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizard89 committed Mar 5, 2024
1 parent c214799 commit ebedd89
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2030,20 +2030,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
Expand Down Expand Up @@ -2071,30 +2077,32 @@ 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)

echoContent green " ---> Xray-core版本:${version}"

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
fi

unzip -o "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" -d /etc/v2ray-agent/xray >/dev/null
rm -rf "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip"
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
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"
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
chmod 655 /etc/v2ray-agent/xray/xray
fi
else
echoContent green " ---> Xray-core版本:$(/etc/v2ray-agent/xray/xray --version | awk '{print $2}' | head -1)"
read -r -p "是否更新、升级?[y/n]:" reInstallXrayStatus
Expand Down Expand Up @@ -7585,7 +7593,7 @@ unInstallXrayCoreReality() {
coreVersionManageMenu() {

if [[ -z "${coreInstallType}" ]]; then
echoContent red "\n ---> >没有检测到安装目录,请执行脚本安装内容"
echoContent red "\n ---> 没有检测到安装目录,请执行脚本安装内容"
menu
exit 0
fi
Expand Down Expand Up @@ -8775,7 +8783,7 @@ menu() {
echoContent red "\n=============================================================="
echoContent green "原作者:mack-a"
echoContent green "作者:Wizard89"
echoContent green "当前版本:v3.0.12"
echoContent green "当前版本:v3.0.13"
echoContent green "Github:https://github.com/Wizard89/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus
Expand Down

0 comments on commit ebedd89

Please sign in to comment.