From c081601e5595bc56b2a3f939cb8a38d3be4af8a4 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Fri, 1 Oct 2021 12:37:57 +0800 Subject: [PATCH] =?UTF-8?q?V6.5.8=20=E4=BF=AE=E5=A4=8D=E5=81=B6=E7=8E=B0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9B=BA=E4=BB=B6=E6=9C=80=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/AutoUpdate.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Scripts/AutoUpdate.sh b/Scripts/AutoUpdate.sh index 8e825de..4ce6534 100755 --- a/Scripts/AutoUpdate.sh +++ b/Scripts/AutoUpdate.sh @@ -3,7 +3,7 @@ # AutoUpdate for Openwrt # Dependences: bash wget-ssl/wget/uclient-fetch curl openssl jsonfilter -Version=V6.5.7 +Version=V6.5.8 function TITLE() { clear && echo "Openwrt-AutoUpdate Script by Hyy2001 ${Version}" @@ -383,7 +383,7 @@ function CHECK_TIME() { } function GET_API() { - local url name size version + local url name date size version local API_Dump=${Running_Path}/API_Dump [[ $(CHECK_TIME ${API_File} 1) == false ]] && { DOWNLOADER --path ${Running_Path} --file-name API_Dump --dl ${DOWNLOADERS} --url "$(URL_X ${Github_Release}/API G@@1 F@@1) ${Github_API}@@1 " --no-url-name --timeout 3 --type 固件信息 --quiet @@ -396,11 +396,15 @@ function GET_API() { local i=1;while :;do url=$(jsonfilter -e '@["assets"]' < ${API_Dump} | jsonfilter -e '@['"""$i"""'].browser_download_url' 2> /dev/null) [[ ! $? == 0 ]] && break - size=$(jsonfilter -e '@["assets"]' < ${API_Dump} | jsonfilter -e '@['"""$i"""'].size' 2> /dev/null) - name=${url##*/} - size=$(echo $size | awk '{a=$1/1048576} {printf("%.2f\n",a)}') - version=$(echo $name | egrep -o "R[0-9.]+-[0-9]+") - echo "${name} ${version} ${size}MB ${url}" | grep -v "API" >> ${API_File} + if [[ ${url} =~ "AutoBuild" || ${url} =~ "${TARGET_PROFILE}" ]] + then + size=$(jsonfilter -e '@["assets"]' < ${API_Dump} | jsonfilter -e '@['"""$i"""'].size' 2> /dev/null) + name=${url##*/} + size=$(echo ${size} | awk '{a=$1/1048576} {printf("%.2f\n",a)}') + version=$(echo ${name} | egrep -o "R[0-9.]+-[0-9]+") + date=$(echo ${version} | cut -d '-' -f2) + printf "%-75s %-20s %-10s %-15s %s\n" ${name} ${version} ${date} ${size}MB ${url} >> ${API_File} + fi i=$(($i + 1)) done } @@ -415,10 +419,10 @@ function GET_CLOUD_INFO() { local Info [[ ! -f ${API_File} ]] && return if [[ $1 =~ (All|all|-a) ]];then - Info=$(grep "AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}" ${API_File} | grep "${x86_Boot}" | sort | uniq) + Info=$(grep "AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}" ${API_File} | grep "${x86_Boot}" | uniq) shift else - Info=$(grep "AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}" ${API_File} | grep "${x86_Boot}" | sort | uniq | awk 'END {print}') + Info=$(grep "AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}" ${API_File} | grep "${x86_Boot}" | awk 'BEGIN {MAX = 0} {if ($3+0 > MAX+0) {MAX=$3 ;content=$0} } END {print content}') fi case "$1" in name) @@ -427,12 +431,15 @@ function GET_CLOUD_INFO() { version) echo "${Info}" | awk '{print $2}' ;; - size) + date) echo "${Info}" | awk '{print $3}' ;; - url) + size) echo "${Info}" | awk '{print $4}' ;; + url) + echo "${Info}" | awk '{print $5}' + ;; esac }