From 31fa0aaa719aea7208743b6ec9cb488d0f53c4d3 Mon Sep 17 00:00:00 2001 From: KANIKIG Date: Tue, 9 Mar 2021 16:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=84=9A=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=B6=85=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gost.sh | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/gost.sh b/gost.sh index a5e21d0..53858c8 100755 --- a/gost.sh +++ b/gost.sh @@ -2,7 +2,7 @@ Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Font_color_suffix="\033[0m" Info="${Green_font_prefix}[信息]${Font_color_suffix}" Error="${Red_font_prefix}[错误]${Font_color_suffix}" -shell_version="1.0.4" +shell_version="1.0.5" gost_conf_path="/etc/gost/config.json" raw_conf_path="/etc/gost/rawconf" function checknew() { @@ -749,23 +749,26 @@ cron_restart() { } update_sh() { - ol_version=$(curl -L -s https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh | grep "shell_version=" | head -1 | awk -F '=|"' '{print $3}') - if [[ "$shell_version" != "$ol_version" ]]; then - echo -e "存在新版本,是否更新 [Y/N]?" - read -r update_confirm - case $update_confirm in - [yY][eE][sS] | [yY]) - wget -N --no-check-certificate https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh - echo -e "更新完成" - exit 0 - ;; - *) ;; + ol_version=$(curl -L -s --connect-timeout 5 https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh | grep "shell_version=" | head -1 | awk -F '=|"' '{print $3}') + if [ -n "$ol_version" ];then + if [[ "$shell_version" != "$ol_version" ]]; then + echo -e "存在新版本,是否更新 [Y/N]?" + read -r update_confirm + case $update_confirm in + [yY][eE][sS] | [yY]) + wget -N --no-check-certificate https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh + echo -e "更新完成" + exit 0 + ;; + *) ;; - esac + esac + else + echo -e " ${Green_font_prefix}当前版本为最新版本!${Font_color_suffix}" + fi else - echo -e " ${Green_font_prefix}当前版本为最新版本!${Font_color_suffix}" + ehco -e " ${Green_font_prefix}脚本最新版本获取失败,请检查与github的连接!${Font_color_suffix}" fi - } update_sh