From f6e8460d0220842e895c71f245fe8168b16eed01 Mon Sep 17 00:00:00 2001 From: wulabing <91d$5gKrmVShheJf> Date: Thu, 26 Dec 2019 15:46:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=9B=B4=E6=96=B0=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E9=80=BB=E8=BE=91=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index c646dad..68cc1ee 100644 --- a/install.sh +++ b/install.sh @@ -24,7 +24,7 @@ Error="${Red}[错误]${Font}" # 版本 shell_version="1.0" - +version_cmp="/tmp/version_cmp.tmp" v2ray_conf_dir="/etc/v2ray" nginx_conf_dir="/etc/nginx/conf/conf.d" v2ray_conf="${v2ray_conf_dir}/config.json" @@ -125,7 +125,7 @@ chrony_install(){ echo -e "${RedBG} 安装终止 ${Font}" exit 2 ;; - esac + esac } dependency_install(){ @@ -694,7 +694,27 @@ install_v2_h2(){ } update_sh(){ - maintain "正在合并代码,请等待更新" + ol_version=$(curl -L -s https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_onekey/master/install.sh \ + | grep "shell_version=" | awk -F "=" '{print $2}') + echo $ol_version > $version_cmp + echo $shell_version >> $version_cmp + if [ "$(sort -rV $version_cmp | head -1)" -gt "$shell_version" ] + then + echo -e "${OK} ${Green} 存在新版本,是否更新 [Y/N]? ${Font}" + read -r update_confirm + case $update_confirm in + [yY][eE][sS]|[yY]) + wget -N https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_onekey/master/install.sh + echo -e "${OK} ${Green} 更新完成 ${Font}" + ;; + *) + exit 0 + ;; + esac + else + echo -e "${OK} ${Green} 当前版本为最新版本 ${Font}" + fi + } maintain(){ echo -e "${RedBG}该选项暂时无法使用${Font}"