From 73ca8787499548fcedaa50d717e7ee94be576ab5 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Sun, 1 Aug 2021 23:54:22 +0800 Subject: [PATCH] =?UTF-8?q?V6.5.4=20=E9=87=8D=E6=96=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9B=BA=E4=BB=B6=E4=BD=93=E7=A7=AF=E6=98=BE=E7=A4=BA;=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/AutoUpdate.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Scripts/AutoUpdate.sh b/Scripts/AutoUpdate.sh index 2bbcc16..f79af9f 100755 --- a/Scripts/AutoUpdate.sh +++ b/Scripts/AutoUpdate.sh @@ -3,7 +3,7 @@ # AutoUpdate for Openwrt # Depends on: bash wget-ssl/wget/uclient-fetch curl x86:gzip openssl -Version=V6.5.3 +Version=V6.5.4 ENV_DEPENDS="Author Github TARGET_PROFILE TARGET_BOARD TARGET_SUBTARGET Firmware_Type CURRENT_Version OP_Maintainer OP_BRANCH OP_REPO_NAME REGEX_Firmware" TITLE() { @@ -253,6 +253,7 @@ CHANGE_GITHUB() { [[ ! ${Github} == $1 ]] && { EDIT_VARIABLE edit ${Custom_Variable} Github $1 ECHO y "Github 地址已修改为: $1" + REMOVE_CACHE } EXIT 0 } @@ -344,15 +345,15 @@ GET_FW_LOG() { FW_Version="$1" ;; esac - if [[ -z $(find ${Run_Path} -type f -mmin -1 -name Update_Logs.json) || ! -s ${Run_Path}/Update_Logs.json ]];then - rm -f ${Run_Path}/Update_Logs.json - DOWNLOADER ${Run_Path}/Update_Logs.json ${Release_URL}/Update_Logs.json - [[ $? == 0 || -s ${Run_Path}/Update_Logs.json ]] && { - touch -a ${Run_Path}/Update_Logs.json - } || rm -f ${Run_Path}/Update_Logs.json + if [[ -z $(find ${Run_Path} -type f -mmin -1 -name FW_Logs.json) || ! -s ${Run_Path}/FW_Logs.json ]];then + rm -f ${Run_Path}/FW_Logs.json + DOWNLOADER ${Run_Path}/FW_Logs.json ${Release_URL}/Update_Logs.json + [[ $? == 0 || -s ${Run_Path}/FW_Logs.json ]] && { + touch -a ${Run_Path}/FW_Logs.json + } || rm -f ${Run_Path}/FW_Logs.json fi - [[ -f ${Run_Path}/Update_Logs.json ]] && { - Result=$(jsonfilter -e '@["'"""${TARGET_PROFILE}"""'"]["'"""${FW_Version}"""'"]' < ${Run_Path}/Update_Logs.json) + [[ -s ${Run_Path}/FW_Logs.json ]] && { + Result=$(jsonfilter -e '@["'"""${TARGET_PROFILE}"""'"]["'"""${FW_Version}"""'"]' < ${Run_Path}/FW_Logs.json 2>/dev/null) [[ -n ${Result} ]] && { echo -e "\n${Grey}${FW_Version} for ${TARGET_PROFILE} 更新日志:" echo -e "\n${Green}${Result}${White}" @@ -398,6 +399,13 @@ GET_CLOUD_VERSION() { [[ -n ${Z} ]] && echo "$Z" } +GET_CLOUD_FW_SIZE() { + local X Y + let X="$(grep -n "$1" ${Run_Path}/Github_Tags | tail -1 | cut -d : -f 1)-4" + let Y="$(sed -n "${X}p" ${Run_Path}/Github_Tags | egrep -o "[0-9]+" | awk '{print ($1)/1048576}' | awk -F. '{print $1}')+1" + [[ ${Y} =~ [0-9] ]] && echo "${Y}M" +} + CHECK_UPDATES() { local A ECHO "正在检查版本更新 ..." @@ -523,6 +531,7 @@ $([[ ${TARGET_BOARD} == x86 ]] && echo "固件格式: ${Firmware_Type} / ${x86_B $(echo -e "当前固件版本: ${CURRENT_Version}${CURRENT_Type}") $(echo -e "云端固件版本: ${CLOUD_FW_Version}${CHECKED_Type}") +云端固件体积: $(GET_CLOUD_FW_SIZE ${CLOUD_FW_Name}) 云端固件名称: ${CLOUD_FW_Name} 固件下载地址: ${CLOUD_FW_URL}