From 748b33ec3eed52f5949db8d137af366c13c388b8 Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 22 Mar 2021 19:11:16 +0800 Subject: [PATCH] autoupdate: fix --- scripts/autoupdate.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/autoupdate.sh b/scripts/autoupdate.sh index db1d552..c46e29f 100644 --- a/scripts/autoupdate.sh +++ b/scripts/autoupdate.sh @@ -19,13 +19,13 @@ board_id=$(cat /etc/board.json | jsonfilter -e '@["model"].name' | tail -c 4 | t mount -t tmpfs -o remount,size=650m tmpfs /tmp rm -rf /tmp/upg && mkdir /tmp/upg && cd /tmp/upg wget https://ghproxy.com/https://github.com/klever1988/nanopi-openwrt/releases/download/$(date +%Y-%m-%d)/$board_id$ver.img.gz -O $board_id.img.gz || true -if [ -f $board_id.img.gz ]; then +if [ $? -eq 0 ]; then wget https://ghproxy.com/https://github.com/klever1988/nanopi-openwrt/releases/download/$(date +%Y-%m-%d)/$board_id$ver.img.md5 -O md5sum.txt echo -e '\e[92m今天固件已下载,准备解压\e[0m' else echo -e '\e[91m今天的固件还没更新,尝试下载昨天的固件\e[0m' wget https://ghproxy.com/https://github.com/klever1988/nanopi-openwrt/releases/download/$(date -d "@$(( $(busybox date +%s) - 86400))" +%Y-%m-%d)/$board_id$ver.img.gz -O $board_id.img.gz || true - if [ -f $board_id.img.gz ]; then + if [ $? -eq 0 ]; then wget https://ghproxy.com/https://github.com/klever1988/nanopi-openwrt/releases/download/$(date -d "@$(( $(busybox date +%s) - 86400))" +%Y-%m-%d)/$board_id$ver.img.md5 -O md5sum.txt echo -e '\e[92m昨天的固件已下载,准备解压\e[0m' else