mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-06-03 00:19:56 -04:00
1.0.18 release
This commit is contained in:
parent
4cb9134e5c
commit
433d854aab
31 changed files with 3718 additions and 57 deletions
|
@ -2243,6 +2243,47 @@ static grub_err_t ventoy_cmd_find_bootable_hdd(grub_extcmd_context_t ctxt, int a
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_read_1st_line(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len = 1024;
|
||||
grub_file_t file;
|
||||
char *buf = NULL;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s file var \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
buf = grub_malloc(len);
|
||||
if (!buf)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
buf[len - 1] = 0;
|
||||
grub_file_read(file, buf, len - 1);
|
||||
|
||||
ventoy_get_line(buf);
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
end:
|
||||
|
||||
grub_check_free(buf);
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_parse_volume(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len;
|
||||
|
@ -2287,6 +2328,44 @@ end:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_parse_create_date(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len;
|
||||
grub_file_t file;
|
||||
char buf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s var \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_memset(buf, 0, sizeof(buf));
|
||||
grub_file_seek(file, 16 * 2048 + 813);
|
||||
len = (int)grub_file_read(file, buf, 17);
|
||||
if (len != 17)
|
||||
{
|
||||
debug("failed to read create date %d\n", len);
|
||||
goto end;
|
||||
}
|
||||
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
end:
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...)
|
||||
{
|
||||
grub_uint64_t size = 0;
|
||||
|
@ -2468,7 +2547,10 @@ static cmd_para ventoy_cmds[] =
|
|||
{ "vt_load_plugin", ventoy_cmd_load_plugin, 0, NULL, "", "", NULL },
|
||||
{ "vt_check_plugin_json", ventoy_cmd_plugin_check_json, 0, NULL, "", "", NULL },
|
||||
|
||||
{ "vt_1st_line", ventoy_cmd_read_1st_line, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_iso_volume", ventoy_cmd_parse_volume, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_iso_create_date", ventoy_cmd_parse_create_date, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_freenas_ver", ventoy_cmd_parse_freenas_ver, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_parse_freebsd_ver", ventoy_cmd_unix_freebsd_ver, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_reset", ventoy_cmd_unix_reset, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_replace_conf", ventoy_cmd_unix_replace_conf, 0, NULL, "", "", NULL },
|
||||
|
|
|
@ -721,6 +721,7 @@ grub_err_t ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt, int argc, char **ar
|
|||
grub_err_t ventoy_cmd_unix_replace_conf(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_replace_ko(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_parse_freenas_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
|
||||
#endif /* __VENTOY_DEF_H__ */
|
||||
|
||||
|
|
|
@ -17,10 +17,8 @@ all_modules_legacy="date drivemap blocklist vga_text ntldr search at_keyboard us
|
|||
net_modules_uefi="efinet net tftp http"
|
||||
all_modules_uefi="blocklist ventoy test 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"
|
||||
|
||||
all_extra_modules="elf macho offsetio regexp file"
|
||||
|
||||
if [ "$1" = "uefi" ]; then
|
||||
all_modules="$net_modules_uefi $all_modules_uefi $all_extra_modules "
|
||||
all_modules="$net_modules_uefi $all_modules_uefi "
|
||||
grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi" --prefix '(,2)/grub' --output "$VT_DIR/INSTALL/EFI/BOOT/grubx64_real.efi" --format 'x86_64-efi' --compression 'auto' $all_modules_uefi 'fat' 'part_msdos'
|
||||
else
|
||||
all_modules="$net_modules_legacy $all_modules_legacy "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue