autoupdate: fix md5 checksum

This commit is contained in:
John Doe
2021-03-21 12:40:36 +08:00
parent d42e01deb3
commit 1c3cb114b3
2 changed files with 11 additions and 9 deletions

View File

@@ -18,15 +18,15 @@ chmod +x /tmp/truncate /tmp/ddnz
board_id=$(cat /etc/board.json | jsonfilter -e '@["model"].name' | tail -c 4 | tr -d "\n" | awk '{print tolower($0)}')
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/$board_id-$(date +%Y-%m-%d)/$board_id.img.gz || true
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
wget https://ghproxy.com/https://github.com/klever1988/nanopi-openwrt/releases/download/$board_id-$(date +%Y-%m-%d)/md5sum.txt
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/$board_id-$(date -d "@$(( $(busybox date +%s) - 86400))" +%Y-%m-%d)/$board_id.img.gz || true
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
wget https://ghproxy.com/https://github.com/klever1988/nanopi-openwrt/releases/download/$board_id-$(date -d "@$(( $(busybox date +%s) - 86400))" +%Y-%m-%d)/md5sum.txt
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
echo -e '\e[91m没找到最新的固件脚本退出\e[0m'