Fix the file path when file checksum in F2 browse mode.

This commit is contained in:
longpanda 2023-01-07 11:33:04 +08:00
parent 72f25f14fc
commit 315cabb945
4 changed files with 8 additions and 5 deletions

View File

@ -260,6 +260,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
grub_file_t file; grub_file_t file;
grub_err_t err; grub_err_t err;
unsigned j; unsigned j;
int vlnk = 0;
file = grub_file_open (args[i], GRUB_FILE_TYPE_TO_HASH file = grub_file_open (args[i], GRUB_FILE_TYPE_TO_HASH
| (!uncompress ? GRUB_FILE_TYPE_NO_DECOMPRESS | (!uncompress ? GRUB_FILE_TYPE_NO_DECOMPRESS
: GRUB_FILE_TYPE_NONE)); : GRUB_FILE_TYPE_NONE));
@ -272,6 +273,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
unread++; unread++;
continue; continue;
} }
vlnk = file->vlnk;
err = hash_file (file, hash, result); err = hash_file (file, hash, result);
grub_file_close (file); grub_file_close (file);
if (err) if (err)
@ -288,7 +290,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
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]); len += grub_snprintf(hashsum + len, sizeof(hashsum) - len, "%02x", ((grub_uint8_t *) result)[j]);
} }
grub_printf (" %s\n", args[i]); grub_printf (" %s\n", vlnk ? grub_file_get_vlnk(args[i], NULL) : args[i]);
grub_env_set("VT_LAST_CHECK_SUM", hashsum); grub_env_set("VT_LAST_CHECK_SUM", hashsum);
} }

View File

@ -200,7 +200,8 @@ const char *grub_file_get_vlnk(const char *name, int *vlnk)
if (len == g_vtoy_vlnk.srclen && grub_strcmp(name, g_vtoy_vlnk.src) == 0) if (len == g_vtoy_vlnk.srclen && grub_strcmp(name, g_vtoy_vlnk.src) == 0)
{ {
*vlnk = 1; if (vlnk)
*vlnk = 1;
return g_vtoy_vlnk.dst; return g_vtoy_vlnk.dst;
} }
@ -208,7 +209,8 @@ const char *grub_file_get_vlnk(const char *name, int *vlnk)
{ {
if (node->srclen == len && grub_strcmp(name, node->src) == 0) if (node->srclen == len && grub_strcmp(name, node->src) == 0)
{ {
*vlnk = 1; if (vlnk)
*vlnk = 1;
return node->dst; return node->dst;
} }
node = node->next; node = node->next;

View File

@ -12,7 +12,7 @@ make install
PATH=$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/:$PATH PATH=$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/:$PATH
net_modules_legacy="net tftp http" net_modules_legacy="net tftp http"
all_modules_legacy="file date drivemap blocklist newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu smbios" all_modules_legacy="file date drivemap blocklist newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal video_fb udf gfxmenu gfxterm gfxterm_background gfxterm_menu smbios"
net_modules_uefi="efinet net tftp http" net_modules_uefi="efinet net tftp http"
all_modules_uefi="file setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu mouse fwload smbios zfs" all_modules_uefi="file setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu mouse fwload smbios zfs"

View File

@ -19,7 +19,6 @@
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
insmod setkey insmod setkey
insmod regexp insmod regexp
insmod video_fb
fi fi
function ventoy_pause { function ventoy_pause {