From f83302488ceb0878cb671a18b528ebaee88384de Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Thu, 3 Sep 2020 15:32:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index a7ddc1f..fa46242 100644 --- a/install.sh +++ b/install.sh @@ -9,7 +9,7 @@ add= globalType= customPath=alone centosVersion=0 -totalProgress= +totalProgress=1 iplc=$1 uuidws= uuidtcp= @@ -498,6 +498,45 @@ installV2Ray(){ fi fi } +# 更新V2Ray +updateV2Ray(){ + echoContent skyBlue "\n进度 $1/${totalProgress} : 更新V2Ray" + if [[ ! -d "/etc/v2ray-agent/v2ray/" ]] + then + echoContent red " ---> 没有检测到安装目录,请执行脚本安装内容" + menu + exit 0; + fi + if [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ctl"` ]] + then + version=`curl -s https://github.com/v2fly/v2ray-core/releases|grep /v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'` + echoContent green " ---> v2ray-core版本:${version}" + wget -q -P /etc/v2ray-agent/v2ray/ https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip + unzip /etc/v2ray-agent/v2ray/v2ray-linux-64.zip -d /etc/v2ray-agent/v2ray > /dev/null + rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip + handleV2Ray start + else + echoContent green " ---> 当前v2ray-core版本:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`" + if [[ ! -z `/etc/v2ray-agent/v2ray/v2ray --version` ]] + then + version=`curl -s https://github.com/v2fly/v2ray-core/releases|grep /v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'` + echo version:${version} + echo version2:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1` + if [[ "${version}" = "v`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`" ]] + then + read -p "当前版本与最新版相同,是否重新安装?[y/n]:" reInstalV2RayStatus + if [[ "${reInstalV2RayStatus}" = "y" ]] + then + handleV2Ray stop + rm -rf /etc/v2ray-agent/v2ray/* + updateV2Ray $1 + else + echoContent green " ---> 放弃更新" + fi + fi + fi + fi +} # 验证整个服务是否可用 checkGFWStatue(){ # 验证整个服务是否可用 @@ -1184,10 +1223,10 @@ menu(){ echoContent green "作者:mack-a" echoContent green "Version:v1.0.9" echoContent red "==============================================================" - echoContent yellow "1.V2Ray+VLESS+TLS+TCP+Web/V2Ray+Vmess+TLS+WS+Web[CDN 云朵必须为灰色]" + echoContent yellow "1.V2Ray+VLESS+TLS+TCP+Web/V2Ray+Vmess+TLS+WS+Web[CDN 云朵必须为灰色] 二合一脚本" # echoContent yellow "2.V2Ray+TCP+TLS" echoContent red "==============================================================" - echoContent yellow "4.更新V2Ray[todo]" + echoContent yellow "4.更新V2Ray" echoContent yellow "5.状态展示[todo]" echoContent yellow "6.安装BBR" echoContent yellow "7.卸载脚本" @@ -1197,6 +1236,9 @@ menu(){ 1) installV2RayVLESSTCPWSTLS ;; + 4) + updateV2Ray 1 + ;; 6) bbrInstall ;;