diff --git a/scripts/autoupdate-usb.sh b/scripts/autoupdate-usb.sh index 99242e0..d0e12a9 100755 --- a/scripts/autoupdate-usb.sh +++ b/scripts/autoupdate-usb.sh @@ -20,6 +20,12 @@ fi unzip R2S*.zip rm R2S*.zip 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 echo -e '\e[92m准备解压镜像文件\e[0m' fi diff --git a/scripts/autoupdate.sh b/scripts/autoupdate.sh index d17eb14..5d69528 100644 --- a/scripts/autoupdate.sh +++ b/scripts/autoupdate.sh @@ -18,6 +18,12 @@ fi unzip R2S*.zip rm R2S*.zip 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 echo -e '\e[92m准备解压镜像文件\e[0m' fi