Ventoy/INSTALL/grub/checksum.cfg
longpanda a93b0f6656 Add .md5/.sha1/.sha256/.sha512 check file feature.
Hotkey m is for calculate checksum and print the result.
If also exist a .md5/.sha1/.sha256/.sha512 file, then it will check the result with the value in the file.
The .md5/.sha1/.sha256/.sha512 suffix is appended to the original file name not replace the original suffix.
For example:
/ISO/Ubuntu-20.04-amd64-desktop.iso
/ISO/Ubuntu-20.04-amd64-desktop.iso.md5
2021-10-24 18:52:09 +08:00

118 lines
3.7 KiB
INI

if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" ]; then
set default=0
menuentry "Calculate and check md5sum" --class=checksum_md5 {
md5sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" vtReadChecksum
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
echo -e "\n\nCheck MD5 value with .md5 file. [ OK ]"
else
echo -e "\n\nCheck MD5 value with .md5 file. [ FAIL ]"
echo "The MD5 value in .md5 file is:"
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
else
menuentry "Calculate md5sum" --class=checksum_md5 {
md5sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
fi
if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" ]; then
set default=1
menuentry "Calculate and check sha1sum" --class=checksum_sha1 {
sha1sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" vtReadChecksum
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
echo -e "\n\nCheck SHA1 value with .sha1 file. [ OK ]"
else
echo -e "\n\nCheck SHA1 value with .sha1 file. [ FAIL ]"
echo "The SHA1 value in .sha1 file is:"
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
else
menuentry "Calculate sha1sum" --class=checksum_sha1 {
sha1sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
fi
if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" ]; then
set default=2
menuentry "Calculate and check sha256sum" --class=checksum_sha256 {
sha256sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" vtReadChecksum
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
echo -e "\n\nCheck SHA256 value with .sha256 file. [ OK ]"
else
echo -e "\n\nCheck SHA256 value with .sha256 file. [ FAIL ]"
echo "The SHA256 value in .sha256 file is:"
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
else
menuentry "Calculate sha256sum" --class=checksum_sha256 {
sha256sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
fi
if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" ]; then
set default=3
menuentry "Calculate and check sha512sum" --class=checksum_sha512{
sha512sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" vtReadChecksum
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
echo -e "\n\nCheck SHA512 value with .sha512 file. [ OK ]"
else
echo -e "\n\nCheck SHA512 value with .sha512 file. [ FAIL ]"
echo "The SHA512 value in .sha512 file is:"
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
else
menuentry "Calculate sha512sum" --class=checksum_sha512{
sha512sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
read vtInputKey
}
fi
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
echo 'Return ...'
}