From ccab3263d606ae1883e5a8dc5d6f7c94a17e6e38 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Tue, 19 Jan 2021 08:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20V2ray=20=E5=AF=BC=E8=87=B4=E7=9A=84=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/AutoBuild_Function.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Scripts/AutoBuild_Function.sh b/Scripts/AutoBuild_Function.sh index 9632df2..49c882e 100644 --- a/Scripts/AutoBuild_Function.sh +++ b/Scripts/AutoBuild_Function.sh @@ -161,18 +161,22 @@ Update_Makefile() { api_URL="https://api.github.com/repos/${_process2}/releases" PKG_DL_URL="https://codeload.github.com/${_process2}/tar.gz/v" Offical_Version="$(curl -s ${api_URL} 2>/dev/null | grep 'tag_name' | egrep -o '[0-9].+[0-9.]+' | awk 'NR==1')" + if [[ -z "${Offical_Version}" ]] && [[ ! "$?" -eq 0 ]];then + echo "Failed to obtain the Offical version,skip update ..." + return + fi Source_Version="$(grep "PKG_VERSION:=" ${Makefile} | cut -c14-20)" Source_HASH="$(grep "PKG_HASH:=" ${Makefile} | cut -c11-100)" echo -e "Current ${PKG_NAME} version: ${Source_Version}\nOffical ${PKG_NAME} version: ${Offical_Version}" - if [[ ! "${Source_Version}" == "${Offical_Version}" ]];then + if [[ ! "${Source_Version}" == "${Offical_Version}" ]] && [[ ! "$?" -eq 0 ]];then echo -e "Updating package ${PKG_NAME} [${Source_Version}] to [${Offical_Version}] ..." sed -i "s?PKG_VERSION:=${Source_Version}?PKG_VERSION:=${Offical_Version}?g" ${Makefile} wget -q "${PKG_DL_URL}${Offical_Version}?" -O /tmp/tmp_file - if [[ $? == 0 ]];then + if [[ "$?" -eq 0 ]];then Offical_HASH=$(sha256sum /tmp/tmp_file | cut -d ' ' -f1) sed -i "s?PKG_HASH:=${Source_HASH}?PKG_HASH:=${Offical_HASH}?g" ${Makefile} else - echo "Update package [${PKG_NAME}] error,skip update ..." + echo "Failed to update the package [${PKG_NAME}],skip update ..." fi fi else