This commit is contained in:
John Doe
2023-12-07 03:57:44 +08:00
parent ecff81c33a
commit 752b7e6480
2 changed files with 8 additions and 8 deletions

View File

@@ -28,9 +28,9 @@ rm -rf /tmp/upg && mkdir /tmp/upg && cd /tmp/upg
latest_release_tag=`get_latest_release stupidloud/nanopi-openwrt`
echo -e '\e[92m准备更新到'$latest_release_tag'\e[0m'
md5sum=`wget https://ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$latest_release_tag/$board_id$ver.img.gz -O- | tee >(gzip -dc>$board_id.img) | md5sum | awk '{print $1}'`
md5sum=`wget https://mirror.ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$latest_release_tag/$board_id$ver.img.gz -O- | tee >(gzip -dc>$board_id.img) | md5sum | awk '{print $1}'`
if [ "$md5sum" != "d41d8cd98f00b204e9800998ecf8427e" ]; then
wget https://ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$latest_release_tag/$board_id$ver.img.gz.md5 -O md5sum.txt
wget https://mirror.ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$latest_release_tag/$board_id$ver.img.gz.md5 -O md5sum.txt
echo -e '\e[92m'$latest_release_tag'固件已下载\e[0m'
fi

View File

@@ -12,8 +12,8 @@ proceed_command sfdisk
proceed_command losetup
proceed_command resize2fs
opkg install coreutils-truncate || true
wget -NP /tmp https://ghproxy.com/https://raw.githubusercontent.com/stupidloud/nanopi-openwrt/zstd-bin/truncate
wget -NP /tmp https://ghproxy.com/https://raw.githubusercontent.com/stupidloud/nanopi-openwrt/zstd-bin/ddnz
wget -NP /tmp https://mirror.ghproxy.com/https://raw.githubusercontent.com/stupidloud/nanopi-openwrt/zstd-bin/truncate
wget -NP /tmp https://mirror.ghproxy.com/https://raw.githubusercontent.com/stupidloud/nanopi-openwrt/zstd-bin/ddnz
chmod +x /tmp/truncate /tmp/ddnz
board_id=$(cat /etc/board.json | jsonfilter -e '@["model"].id' | sed 's/friendly.*,nanopi-//;s/xunlong,orangepi-//;s/^r1s-h5$/r1s/;s/^r1$/r1s-h3/;s/^r1-plus$/r1p/;s/^r1-plus-lts$/r1p-lts/;s/default-string-default-string/x86/;s/vmware-inc-vmware7-1/x86/')
@@ -22,15 +22,15 @@ arch=`uname -m`
mount -t tmpfs -o remount,size=850m tmpfs /tmp
rm -rf /tmp/upg && mkdir /tmp/upg && cd /tmp/upg
set +e
wget https://ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$(date +%Y-%m-%d)/$board_id$ver.img.gz -O- | gzip -dc > $board_id.img
wget https://mirror.ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$(date +%Y-%m-%d)/$board_id$ver.img.gz -O- | gzip -dc > $board_id.img
if [ $? -eq 0 ]; then
wget https://ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$(date +%Y-%m-%d)/$board_id$ver.img.md5 -O md5sum.txt
wget https://mirror.ghproxy.com/https://github.com/stupidloud/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/stupidloud/nanopi-openwrt/releases/download/$(date -d "@$(( $(busybox date +%s) - 86400))" +%Y-%m-%d)/$board_id$ver.img.gz -O- | gzip -dc > $board_id.img
wget https://mirror.ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$(date -d "@$(( $(busybox date +%s) - 86400))" +%Y-%m-%d)/$board_id$ver.img.gz -O- | gzip -dc > $board_id.img
if [ $? -eq 0 ]; then
wget https://ghproxy.com/https://github.com/stupidloud/nanopi-openwrt/releases/download/$(date -d "@$(( $(busybox date +%s) - 86400))" +%Y-%m-%d)/$board_id$ver.img.md5 -O md5sum.txt
wget https://mirror.ghproxy.com/https://github.com/stupidloud/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'