diff --git a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c index 1f44355b..56cb3948 100644 --- a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c +++ b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c @@ -1484,7 +1484,7 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open { AsciiStrCpyS(OldName, sizeof(OldName), g_img_replace_list[i].old_file_name[j]); if ((0 == AsciiStrCmp(OldName, TmpName)) || - (AsciiStrnCmp(OldName, "\\loader\\entries", 15) == 0 && + (AsciiStrnCmp(OldName, "\\loader\\entries\\", 16) == 0 && AsciiStrCmp(OldName + 16, TmpName) == 0 ) ) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c index 8be3d8ac..7dc63f18 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c @@ -224,6 +224,8 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt, int keep = state[3].set; int uncompress = state[4].set; unsigned unread = 0; + int len = 0; + char hashsum[256]; for (i = 0; i < ARRAY_SIZE (aliases); i++) if (grub_strcmp (ctxt->extcmd->cmd->name, aliases[i].name) == 0) @@ -282,8 +284,12 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt, continue; } for (j = 0; j < hash->mdlen; j++) - grub_printf ("%02x", ((grub_uint8_t *) result)[j]); + { + grub_printf ("%02x", ((grub_uint8_t *) result)[j]); + len += grub_snprintf(hashsum + len, sizeof(hashsum) - len, "%02x", ((grub_uint8_t *) result)[j]); + } grub_printf (" %s\n", args[i]); + grub_env_set("VT_LAST_CHECK_SUM", hashsum); } if (unread) diff --git a/INSTALL/grub/checksum.cfg b/INSTALL/grub/checksum.cfg index 53dc6387..cea88fce 100644 --- a/INSTALL/grub/checksum.cfg +++ b/INSTALL/grub/checksum.cfg @@ -1,30 +1,116 @@ -menuentry "Calculate md5sum" --class=checksum_md5 { - md5sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" - - echo -e "\n\npress ENTER to exit ..." - read vtInputKey -} -menuentry "Calculate sha1sum" --class=checksum_sha1 { - sha1sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" - - echo -e "\n\npress ENTER to exit ..." - read vtInputKey -} +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 -menuentry "Calculate sha256sum" --class=checksum_sha256 { - sha256sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" - - echo -e "\n\npress ENTER to exit ..." - read vtInputKey -} +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 "Calculate sha512sum" --class=checksum_sha512{ - sha512sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" - - echo -e "\n\npress ENTER to exit ..." - read vtInputKey -} menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { echo 'Return ...'