Update script: verify MD5 for file before upgrading.

This commit is contained in:
kongfl888
2020-06-17 02:53:50 +08:00
parent 2c0e89b7ac
commit 8a67f6585a
2 changed files with 12 additions and 0 deletions

View File

@@ -20,6 +20,12 @@ fi
unzip R2S*.zip unzip R2S*.zip
rm R2S*.zip rm R2S*.zip
if [ -f /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz ]; then if [ -f /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz ]; then
cd /mnt/mmcblk0p2/artifact/
if [ `md5sum -c md5sum.txt|grep -c "OK"` -eq 0 ]; then
echo -e '\e[91m固件HASH值匹配失败脚本退出\e[0m'
exit 1
fi
cd /mnt/mmcblk0p2
pv /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz | gunzip -dc > FriendlyWrt.img pv /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz | gunzip -dc > FriendlyWrt.img
echo -e '\e[92m准备解压镜像文件\e[0m' echo -e '\e[92m准备解压镜像文件\e[0m'
fi fi

View File

@@ -18,6 +18,12 @@ fi
unzip R2S*.zip unzip R2S*.zip
rm R2S*.zip rm R2S*.zip
if [ -f /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz ]; then if [ -f /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz ]; then
cd /mnt/mmcblk0p2/artifact/
if [ `md5sum -c md5sum.txt|grep -c "OK"` -eq 0 ]; then
echo -e '\e[91m固件HASH值匹配失败脚本退出\e[0m'
exit 1
fi
cd /mnt/mmcblk0p2
pv /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz | gunzip -dc > FriendlyWrt.img pv /mnt/mmcblk0p2/artifact/FriendlyWrt*.img.gz | gunzip -dc > FriendlyWrt.img
echo -e '\e[92m准备解压镜像文件\e[0m' echo -e '\e[92m准备解压镜像文件\e[0m'
fi fi