fix(脚本): 修复centos7 wget show-progress 问题

dev
mack-a 2023-04-08 21:13:39 +08:00
parent 272422665b
commit 137a45d190
1 changed files with 47 additions and 36 deletions

View File

@ -252,6 +252,9 @@ initVar() {
wildcardDomainStatus= wildcardDomainStatus=
# 通过nginx检查的端口 # 通过nginx检查的端口
nginxIPort= nginxIPort=
# wget show progress
wgetShowProgressStatus=
} }
# 读取tls证书详情 # 读取tls证书详情
@ -1709,11 +1712,11 @@ installV2Ray() {
fi fi
echoContent green " ---> v2ray-core版本:${version}" echoContent green " ---> v2ray-core版本:${version}"
if wget --help | grep -q show-progress; then # if wget --help | grep -q show-progress; then
wget -c -q --show-progress -P /etc/v2ray-agent/v2ray/ "https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip" wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/v2ray/ "https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip"
else # else
wget -c -P /etc/v2ray-agent/v2ray/ "https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip" >/dev/null 2>&1 # wget -c -P /etc/v2ray-agent/v2ray/ "https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip" >/dev/null 2>&1
fi # fi
unzip -o "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip" -d /etc/v2ray-agent/v2ray >/dev/null unzip -o "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip" -d /etc/v2ray-agent/v2ray >/dev/null
rm -rf "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip" rm -rf "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip"
@ -1745,11 +1748,11 @@ installHysteria() {
version=$(curl -s https://api.github.com/repos/apernet/hysteria/releases | jq -r '.[]|select (.prerelease==false)|.tag_name' | head -1) version=$(curl -s https://api.github.com/repos/apernet/hysteria/releases | jq -r '.[]|select (.prerelease==false)|.tag_name' | head -1)
echoContent green " ---> Hysteria版本:${version}" echoContent green " ---> Hysteria版本:${version}"
if wget --help | grep -q show-progress; then # if wget --help | grep -q show-progress; then
wget -c -q --show-progress -P /etc/v2ray-agent/hysteria/ "https://github.com/apernet/hysteria/releases/download/${version}/${hysteriaCoreCPUVendor}" wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/hysteria/ "https://github.com/apernet/hysteria/releases/download/${version}/${hysteriaCoreCPUVendor}"
else # else
wget -c -P /etc/v2ray-agent/hysteria/ "https://github.com/apernet/hysteria/releases/download/${version}/${hysteriaCoreCPUVendor}" >/dev/null 2>&1 # wget -c -P /etc/v2ray-agent/hysteria/ "https://github.com/apernet/hysteria/releases/download/${version}/${hysteriaCoreCPUVendor}" >/dev/null 2>&1
fi # fi
mv "/etc/v2ray-agent/hysteria/${hysteriaCoreCPUVendor}" /etc/v2ray-agent/hysteria/hysteria mv "/etc/v2ray-agent/hysteria/${hysteriaCoreCPUVendor}" /etc/v2ray-agent/hysteria/hysteria
chmod 655 /etc/v2ray-agent/hysteria/hysteria chmod 655 /etc/v2ray-agent/hysteria/hysteria
else else
@ -1762,6 +1765,12 @@ installHysteria() {
fi fi
} }
# 检查wget showProgress
checkWgetShowProgress() {
if find /usr/bin /usr/sbin | grep -q -w wget && wget --help | grep -q show-progress; then
wgetShowProgressStatus="--show-progress"
fi
}
# 安装xray # 安装xray
installXray() { installXray() {
readInstallType readInstallType
@ -1778,11 +1787,11 @@ installXray() {
echoContent green " ---> Xray-core版本:${version}" echoContent green " ---> Xray-core版本:${version}"
if wget --help | grep -q show-progress; then # if wget --help | grep -q show-progress; then
wget -c -q --show-progress -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"
else # else
wget -c -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" >/dev/null 2>&1 # wget -c -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" >/dev/null 2>&1
fi # fi
if [[ ! -f "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" ]]; then if [[ ! -f "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" ]]; then
echoContent red " ---> 核心下载失败,请重新尝试安装" echoContent red " ---> 核心下载失败,请重新尝试安装"
exit 0 exit 0
@ -1795,8 +1804,9 @@ installXray() {
echoContent skyBlue "------------------------Version-------------------------------" echoContent skyBlue "------------------------Version-------------------------------"
echo "version:${version}" echo "version:${version}"
rm /etc/v2ray-agent/xray/geo* >/dev/null 2>&1 rm /etc/v2ray-agent/xray/geo* >/dev/null 2>&1
wget -c -q --show-progress -P /etc/v2ray-agent/xray/ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geosite.dat"
wget -c -q --show-progress -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
else else
@ -1914,8 +1924,8 @@ updateGeoSite() {
echoContent skyBlue "------------------------Version-------------------------------" echoContent skyBlue "------------------------Version-------------------------------"
echo "version:${version}" echo "version:${version}"
rm ${configPath}../geo* >/dev/null rm ${configPath}../geo* >/dev/null
wget -c -q --show-progress -P ${configPath}../ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geosite.dat" wget -c -q "${wgetShowProgressStatus}" -P ${configPath}../ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geosite.dat"
wget -c -q --show-progress -P ${configPath}../ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geoip.dat" wget -c -q "${wgetShowProgressStatus}" -P ${configPath}../ "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geoip.dat"
reloadCore reloadCore
echoContent green " ---> 更新完毕" echoContent green " ---> 更新完毕"
@ -1935,12 +1945,11 @@ updateV2Ray() {
version=${v2rayCoreVersion} version=${v2rayCoreVersion}
fi fi
echoContent green " ---> v2ray-core版本:${version}" echoContent green " ---> v2ray-core版本:${version}"
# if wget --help | grep -q show-progress; then
if wget --help | grep -q show-progress; then wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/v2ray/ "https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip"
wget -c -q --show-progress -P /etc/v2ray-agent/v2ray/ "https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip" # else
else # wget -c -P "/etc/v2ray-agent/v2ray/ https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip" >/dev/null 2>&1
wget -c -P "/etc/v2ray-agent/v2ray/ https://github.com/v2fly/v2ray-core/releases/download/${version}/${v2rayCoreCPUVendor}.zip" >/dev/null 2>&1 # fi
fi
unzip -o "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip" -d /etc/v2ray-agent/v2ray >/dev/null unzip -o "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip" -d /etc/v2ray-agent/v2ray >/dev/null
rm -rf "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip" rm -rf "/etc/v2ray-agent/v2ray/${v2rayCoreCPUVendor}.zip"
@ -2010,11 +2019,11 @@ updateXray() {
echoContent green " ---> Xray-core版本:${version}" echoContent green " ---> Xray-core版本:${version}"
if wget --help | grep -q show-progress; then # if wget --help | grep -q show-progress; then
wget -c -q --show-progress -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"
else # else
wget -c -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" >/dev/null 2>&1 # wget -c -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" >/dev/null 2>&1
fi # fi
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"
@ -4405,11 +4414,11 @@ removeUser() {
updateV2RayAgent() { updateV2RayAgent() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 更新v2ray-agent脚本" echoContent skyBlue "\n进度 $1/${totalProgress} : 更新v2ray-agent脚本"
rm -rf /etc/v2ray-agent/install.sh rm -rf /etc/v2ray-agent/install.sh
if wget --help | grep -q show-progress; then # if wget --help | grep -q show-progress; then
wget -c -q --show-progress -P /etc/v2ray-agent/ -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh" wget -c -q "${wgetShowProgressStatus}" -P /etc/v2ray-agent/ -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh"
else # else
wget -c -q -P /etc/v2ray-agent/ -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh" # wget -c -q -P /etc/v2ray-agent/ -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh"
fi # fi
sudo chmod 700 /etc/v2ray-agent/install.sh sudo chmod 700 /etc/v2ray-agent/install.sh
local version local version
@ -6103,13 +6112,15 @@ hysteriaVersionManageMenu() {
} }
# 主菜单 # 主菜单
menu() { menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.8.0" echoContent green "当前版本v2.8.1"
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
checkWgetShowProgress
echoContent red "\n=========================== 推广区============================" echoContent red "\n=========================== 推广区============================"
echoContent red " " echoContent red " "
echoContent green "推广请联系TG@mackaff\n" echoContent green "推广请联系TG@mackaff\n"