1 #************************************************************************************
2 # Copyright (c) 2020, longpanda <admin@ventoy.net>
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3 of the
7 # License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, see <http://www.gnu.org/licenses/>.
17 #************************************************************************************
19 if [ "$grub_platform" = "pc" ]; then
24 function ventoy_pause {
25 echo "press Enter to continue ......"
29 function ventoy_debug_pause {
30 if [ -n "${vtdebug_flag}" ]; then
31 echo "press Enter to continue ......"
37 function ventoy_max_resolution {
39 smbios -t 1 -s 0x05 --set=system_product;
40 for vtPdt in "VMware" "VirtualBox"; then
41 if vt_str_casebegin "$system_product" "$vtPdt"; then
47 vt_get_video_mode 0 vtCurMode
48 terminal_output console
49 set gfxmode=$vtCurMode
50 terminal_output gfxterm
53 function ventoy_cli_console {
54 if [ -z "$vtoy_display_mode" ]; then
55 terminal_output console
56 elif [ "$vtoy_display_mode" = "GUI" ]; then
57 terminal_output console
61 function ventoy_gui_console {
62 if [ -z "$vtoy_display_mode" ]; then
63 terminal_output gfxterm
64 elif [ "$vtoy_display_mode" = "GUI" ]; then
65 terminal_output gfxterm
69 function ventoy_acpi_param {
70 if [ "$VTOY_PARAM_NO_ACPI" != "1" ]; then
71 vt_acpi_param "$1" "$2"
75 function ventoy_vcfg_proc {
76 if vt_check_custom_boot "${1}" vt_vcfg; then
77 set vtoy_chosen_path="${1}"
78 vt_file_basefile "${vtoy_chosen_path}" vtoy_chosen_file
80 export vtoy_chosen_path
81 export vtoy_chosen_file
83 configfile "${vtoy_iso_part}${vt_vcfg}"
90 function ventoy_language {
91 configfile $prefix/menulang.cfg
94 function ventoy_diagnosis {
96 configfile $prefix/debug.cfg
99 function ventoy_localboot {
100 configfile $prefix/localboot.cfg
103 function ventoy_ext_menu {
104 if [ -e $vt_plugin_path/ventoy/ventoy_grub.cfg ]; then
105 set ventoy_new_context=1
106 configfile $vt_plugin_path/ventoy/ventoy_grub.cfg
107 unset ventoy_new_context
109 echo "ventoy_grub.cfg NOT exist."
110 echo -en "\n$VTLANG_ENTER_EXIT ..."
115 function ventoy_checksum {
116 if [ -f "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" ]; then
117 configfile $prefix/checksum.cfg
121 function ventoy_show_help {
122 if [ -f $prefix/help.tar.gz ]; then
123 if [ -z "$vtoy_help_txt_mem_addr" ]; then
124 vt_load_file_to_mem "auto" $prefix/help.tar.gz vtoy_help_txt_mem
127 loopback vt_help_tarfs mem:${vtoy_help_txt_mem_addr}:size:${vtoy_help_txt_mem_size}
128 vt_cur_menu_lang vtCurLang
129 if [ -f "(vt_help_tarfs)/help/${vtCurLang}.txt" ]; then
130 cat "(vt_help_tarfs)/help/${vtCurLang}.txt"
132 cat "(vt_help_tarfs)/help/en_US.txt"
134 loopback -d vt_help_tarfs
138 function ventoy_load_menu_lang_file {
139 vt_load_file_to_mem "auto" $prefix/menu.tar.gz vtoy_menu_lang_mem
140 loopback vt_menu_tarfs mem:${vtoy_menu_lang_mem_addr}:size:${vtoy_menu_lang_mem_size}
143 function get_os_type {
147 if vt_str_begin "$vt_volume_id" "DLC Boot"; then
148 if [ -f (loop)/DLCBoot.exe ]; then
152 for file in "efi/microsoft/boot/bcd" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com" ; do
153 if vt_file_exist_nocase (loop)/$file; then
160 if [ "$vtoy_os" = "Linux" ]; then
161 if vt_strstr "$vt_system_id" "FreeBSD"; then
163 set vt_unix_type=FreeBSD
164 elif [ -e (loop)/bin/freebsd-version ]; then
166 set vt_unix_type=FreeBSD
167 elif [ -e (loop)/boot/kernel/geom_ventoy.ko ]; then
169 set vt_unix_type=FreeBSD
170 elif vt_str_begin "$vt_system_id" "DragonFly"; then
172 set vt_unix_type=DragonFly
175 elif [ -e (loop)/boot/kernel/kernel ]; then
176 if file --is-x86-kfreebsd (loop)/boot/kernel/kernel; then
178 set vt_unix_type=FreeBSD
179 elif file --is-x86-knetbsd (loop)/boot/kernel/kernel; then
181 set vt_unix_type=NetBSD
186 if [ -n "${vtdebug_flag}" ]; then
187 echo ISO is "$vtoy_os"
191 function vt_check_compatible_pe {
192 #Check for PE without external tools
193 #set compatible if ISO file is less than 80MB
194 if [ $vt_chosen_size -GT 33554432 -a $vt_chosen_size -LE 83886080 ]; then
195 set ventoy_compatible=YES
201 function vt_check_compatible_linux {
202 if vt_str_begin "$vt_volume_id" "embootkit"; then
203 set ventoy_compatible=YES
204 elif [ -e "$1/casper/tinycore.gz" ]; then
205 set ventoy_compatible=YES
211 function locate_initrd {
212 vt_linux_locate_initrd
214 if [ -n "${vtdebug_flag}" ]; then
220 function locate_wim {
221 vt_windows_locate_wim_patch (loop) "$1"
223 if [ -n "${vtdebug_flag}" ]; then
224 echo '###############################################'
226 echo '###############################################'
231 function distro_specify_wim_patch {
232 if [ -d (loop)/h3pe ]; then
233 vt_windows_collect_wim_patch wim /BOOT/H3_10PE.WIM
234 vt_windows_collect_wim_patch wim /BOOT/H3_7PE.WIM
235 vt_windows_collect_wim_patch wim /BOOT/H3_8PE.WIM
236 vt_windows_collect_wim_patch wim /BOOT/H3_81PE.WIM
237 elif [ -d (loop)/2k10/winpe ]; then
238 vt_windows_collect_wim_patch wim /2k10/winpe/w1086pe.wim
239 vt_windows_collect_wim_patch wim /2k10/winpe/w8x86pe.wim
240 vt_windows_collect_wim_patch wim /2k10/winpe/w7x86pe.wim
244 function distro_specify_wim_patch_phase2 {
245 if [ -f (loop)/boot/boot.wim ]; then
246 vt_windows_collect_wim_patch wim /boot/boot.wim
247 elif [ -f (loop)/sources/boot.wim ]; then
248 vt_windows_collect_wim_patch wim /sources/boot.wim
251 if vt_str_begin "$vt_volume_id" "DLC Boot"; then
252 for vwfile in "/DLC1/WinPE/W11x64.wim" "/DLC1/WinPE/W10x64.wim" "/DLC1/WinPE/W10x86.wim"; do
253 if [ -f (loop)/$vwfile ]; then
254 vt_windows_collect_wim_patch wim $vwfile
262 function distro_specify_initrd_file {
263 if [ -e (loop)/boot/all.rdz ]; then
264 vt_linux_specify_initrd_file /boot/all.rdz
265 elif [ -e (loop)/boot/xen.gz ]; then
266 if [ -e (loop)/install.img ]; then
267 vt_linux_specify_initrd_file /install.img
269 elif [ -d (loop)/casper ]; then
270 if [ -e (loop)/casper/initrd ]; then
271 vt_linux_specify_initrd_file /casper/initrd
273 if [ -e (loop)/casper/initrd.gz ]; then
274 vt_linux_specify_initrd_file /casper/initrd.gz
276 if [ -e (loop)/casper/initrd-oem ]; then
277 vt_linux_specify_initrd_file /casper/initrd-oem
279 elif [ -e (loop)/boot/grub/initrd.xz ]; then
280 vt_linux_specify_initrd_file /boot/grub/initrd.xz
281 elif [ -e (loop)/initrd.gz ]; then
282 vt_linux_specify_initrd_file /initrd.gz
283 elif [ -e (loop)/slax/boot/initrfs.img ]; then
284 vt_linux_specify_initrd_file /slax/boot/initrfs.img
285 elif [ -e (loop)/minios/boot/initrfs.img ]; then
286 vt_linux_specify_initrd_file /minios/boot/initrfs.img
287 elif [ -e (loop)/pmagic/initrd.img ]; then
288 vt_linux_specify_initrd_file /pmagic/initrd.img
289 elif [ -e (loop)/boot/initrd.xz ]; then
290 vt_linux_specify_initrd_file /boot/initrd.xz
291 elif [ -e (loop)/boot/initrd.gz ]; then
292 vt_linux_specify_initrd_file /boot/initrd.gz
293 elif [ -f (loop)/boot/initrd ]; then
294 vt_linux_specify_initrd_file /boot/initrd
295 elif [ -f (loop)/boot/x86_64/loader/initrd ]; then
296 vt_linux_specify_initrd_file /boot/x86_64/loader/initrd
297 elif [ -f (loop)/boot/initramfs-x86_64.img ]; then
298 vt_linux_specify_initrd_file /boot/initramfs-x86_64.img
299 elif [ -f (loop)/boot/isolinux/initramfs_data64.cpio.gz ]; then
300 vt_linux_specify_initrd_file /boot/isolinux/initramfs_data64.cpio.gz
301 elif [ -f (loop)/boot/initrd.img ]; then
302 vt_linux_specify_initrd_file /boot/initrd.img
306 if [ -f (loop)/isolinux/initrd.gz ]; then
307 vt_linux_specify_initrd_file /isolinux/initrd.gz
310 if vt_str_begin "$vt_volume_id" "QUBES"; then
311 vt_linux_specify_initrd_file /images/pxeboot/initrd.img
314 if [ "$vt_chosen_size" = "1133375488" ]; then
315 if [ -d (loop)/boot/grub/x86_64-efi ]; then
316 vt_cpio_busybox64 "64h"
322 function distro_specify_initrd_file_phase2 {
323 if [ -f (loop)/boot/initrd.img ]; then
324 vt_linux_specify_initrd_file /boot/initrd.img
325 elif [ -f (loop)/Setup/initrd.gz ]; then
326 vt_linux_specify_initrd_file /Setup/initrd.gz
327 elif [ -f (loop)/isolinux/initramfs ]; then
328 vt_linux_specify_initrd_file /isolinux/initramfs
329 elif [ -f (loop)/boot/iniramfs.igz ]; then
330 vt_linux_specify_initrd_file /boot/iniramfs.igz
331 elif [ -f (loop)/initrd-x86_64 ]; then
332 vt_linux_specify_initrd_file /initrd-x86_64
333 elif [ -f (loop)/live/initrd.img ]; then
334 vt_linux_specify_initrd_file /live/initrd.img
335 elif [ -f (loop)/initrd.img ]; then
336 vt_linux_specify_initrd_file /initrd.img
337 elif [ -f (loop)/sysresccd/boot/x86_64/sysresccd.img ]; then
338 vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
339 elif [ -f (loop)/CDlinux/initrd ]; then
340 vt_linux_specify_initrd_file /CDlinux/initrd
341 elif [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
342 vt_linux_specify_initrd_file /parabola/boot/x86_64/parabolaiso.img
343 if [ -f (loop)/parabola/boot/i686/parabolaiso.img ]; then
344 vt_linux_specify_initrd_file /parabola/boot/i686/parabolaiso.img
346 elif [ -f (loop)/parabola/boot/x86_64/initramfs-linux-libre.img ]; then
347 vt_linux_specify_initrd_file /parabola/boot/x86_64/initramfs-linux-libre.img
348 if [ -f (loop)/parabola/boot/i686/initramfs-linux-libre.img ]; then
349 vt_linux_specify_initrd_file /parabola/boot/i686/initramfs-linux-libre.img
351 elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
352 vt_linux_specify_initrd_file /hyperbola/boot/x86_64/hyperiso.img
353 if [ -f (loop)/hyperbola/boot/i686/hyperiso.img ]; then
354 vt_linux_specify_initrd_file /hyperbola/boot/i686/hyperiso.img
356 elif [ -f (loop)/EFI/BOOT/initrd.img ]; then
358 vt_linux_specify_initrd_file /EFI/BOOT/initrd.img
359 if [ "$grub_platform" != "pc" ]; then
360 vt_add_replace_file 0 "initrd.img"
362 elif [ -f (loop)/initrd ]; then
363 vt_linux_specify_initrd_file /initrd
364 elif [ -f (loop)/live/initrd1 ]; then
365 vt_linux_specify_initrd_file /live/initrd1
366 elif [ -f (loop)/isolinux/initrd.img ]; then
367 vt_linux_specify_initrd_file /isolinux/initrd.img
368 elif [ -f (loop)/isolinux/initrd.gz ]; then
369 vt_linux_specify_initrd_file /isolinux/initrd.gz
370 elif [ -f (loop)/syslinux/kernel/initramfs.gz ]; then
371 vt_linux_specify_initrd_file /syslinux/kernel/initramfs.gz
372 elif vt_strstr "$vt_volume_id" "Daphile"; then
373 vt_linux_parse_initrd_isolinux (loop)/isolinux/
374 elif [ -f (loop)/boot/rootfs.xz ]; then
375 vt_linux_specify_initrd_file /boot/rootfs.xz
376 if [ "$grub_platform" != "pc" ]; then
377 vt_add_replace_file 0 "minimal\\x86_64\\rootfs.xz"
379 elif [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
380 vt_linux_specify_initrd_file /arch/boot/x86_64/archiso.img
381 if [ "$grub_platform" != "pc" ]; then
382 vt_add_replace_file 0 "EFI\\archiso\\archiso.img"
384 elif [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
385 vt_linux_specify_initrd_file /blackarch/boot/x86_64/archiso.img
386 elif [ -f (loop)/blackarch/boot/x86_64/initramfs-linux.img ]; then
387 vt_linux_specify_initrd_file /blackarch/boot/x86_64/initramfs-linux.img
389 elif [ -f (loop)/install.amd/initrd.gz ]; then
390 vt_linux_specify_initrd_file /live/initrd2.img
391 vt_linux_specify_initrd_file /install.amd/initrd.gz
392 vt_linux_specify_initrd_file /install.amd/gtk/initrd.gz
393 elif [ -f (loop)/boot/grub/kernels.cfg ]; then
394 vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
395 elif [ -f (loop)/austrumi/initrd.gz ]; then
396 vt_linux_specify_initrd_file /austrumi/initrd.gz
397 if [ -f (loop)/EFI/BOOT/bootx64.efi ]; then
398 vt_cpio_busybox64 "64h"
400 elif [ -f (loop)/boot/initfs.x86_64-efi ]; then
401 vt_linux_specify_initrd_file /boot/initfs.x86_64-efi
402 if [ -f (loop)/boot/initfs.i386-pc ]; then
403 vt_linux_specify_initrd_file /boot/initfs.i386-pc
405 elif [ -f (loop)/antiX/initrd.gz ]; then
406 vt_linux_specify_initrd_file /antiX/initrd.gz
407 elif [ -f (loop)/360Disk/initrd.gz ]; then
408 vt_linux_specify_initrd_file /360Disk/initrd.gz
409 elif [ -f (loop)/porteus/initrd.xz ]; then
410 vt_linux_specify_initrd_file /porteus/initrd.xz
411 elif [ -f (loop)/pyabr/boot/initrfs.img ]; then
412 vt_linux_specify_initrd_file /pyabr/boot/initrfs.img
413 elif [ -f (loop)/initrd0.img ]; then
414 vt_linux_specify_initrd_file /initrd0.img
415 elif [ -f (loop)/sysresccd/boot/i686/sysresccd.img ]; then
416 vt_linux_specify_initrd_file /sysresccd/boot/i686/sysresccd.img
417 elif [ -f (loop)/boot/full.cz ]; then
418 vt_linux_specify_initrd_file /boot/full.cz
419 elif [ -f (loop)/images/pxeboot/initrd.img ]; then
420 vt_linux_specify_initrd_file /images/pxeboot/initrd.img
421 elif [ -f (loop)/live/initrd ]; then
422 vt_linux_specify_initrd_file /live/initrd
423 elif [ -f (loop)/initramfs-linux.img ]; then
424 vt_linux_specify_initrd_file /initramfs-linux.img
425 elif [ -f (loop)/boot/isolinux/initrd.gz ]; then
426 vt_linux_specify_initrd_file /boot/isolinux/initrd.gz
431 function ventoy_get_ghostbsd_ver {
432 # fallback to parse version from elf /boot/kernel/kernel
433 set vt_freebsd_ver=xx
436 function ventoy_get_furybsd_ver {
437 set vt_freebsd_ver=12.x
438 if regexp --set 1:vtFuryVer "(14|13)\.[0-9]" "$2"; then
439 set vt_freebsd_ver=${vtFuryVer}.x
443 function ventoy_get_freenas_ver {
444 set vt_freebsd_ver=11.x
446 if [ -e (loop)/FreeNAS-MANIFEST ]; then
447 vt_parse_freenas_ver (loop)/FreeNAS-MANIFEST vt_freenas_ver
448 if regexp --set 1:vtNasVer "^(14|13|12|11)\.[0-9]" "$vt_freenas_ver"; then
449 set vt_freebsd_ver=${vtNasVer}.x
454 function ventoy_get_truenas_ver {
455 set vt_freebsd_ver=12.x
457 if [ -e (loop)/TrueNAS-MANIFEST ]; then
458 vt_parse_freenas_ver (loop)/TrueNAS-MANIFEST vt_truenas_ver
459 if regexp --set 1:vtTNasVer "^(14|13|12|11)\.[0-9]" "$vt_truenas_ver"; then
460 set vt_freebsd_ver=${vtTNasVer}.x
465 function ventoy_get_midnightbsd_ver {
466 if vt_str_begin "$vt_volume_id" "1_"; then
467 set vt_freebsd_ver=11.x
468 elif vt_str_begin "$vt_volume_id" "2_"; then
469 set vt_freebsd_ver=2.x
470 elif vt_str_begin "$vt_volume_id" "3_"; then
471 set vt_freebsd_ver=3.x
475 function ventoy_freebsd_proc {
476 set vtFreeBsdDistro=FreeBSD
477 set vt_freebsd_ver=xx
479 if [ -e (loop)/boot/kernel/geom_ventoy.ko ]; then
480 vt_unix_ko_fillmap /boot/kernel/geom_ventoy.ko
484 if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
485 ventoy_get_ghostbsd_ver "$1" "${chosen_path}"
486 elif vt_strstr "$vt_volume_id" "FREENAS"; then
487 ventoy_get_freenas_ver "$1" "${chosen_path}"
488 elif vt_strstr "$vt_volume_id" "TRUENAS"; then
489 ventoy_get_truenas_ver "$1" "${chosen_path}"
490 elif vt_strstr "$vt_volume_id" "FURYBSD"; then
491 ventoy_get_furybsd_ver "$1" "${chosen_path}"
492 elif regexp --set 1:vtBsdVerNum "^(14|13|12|11|10|9)_[0-9]" "$vt_volume_id"; then
493 set vt_freebsd_ver=${vtBsdVerNum}.x
494 elif [ -d (loop)/usr/midnightbsd-dist ]; then
495 ventoy_get_midnightbsd_ver "$1" "${chosen_path}"
496 set vtFreeBsdDistro=MidnightBSD
497 elif [ -e (loop)/bin/freebsd-version ]; then
498 vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
499 if regexp --set 1:vtBsdVerNum "\"(14|13|12|11|10|9)\.[0-9]-" "$vt_userland_ver"; then
500 set vt_freebsd_ver=${vtBsdVerNum}.x
502 elif [ -e (loop)/README.TXT ]; then
503 vt_1st_line (loop)/README.TXT vt_freebsd_line1
504 if regexp --set 1:vtBsdVerNum "FreeBSD (14|13|12|11|10|9)\.[0-9]-" "$vt_freebsd_line1"; then
505 set vt_freebsd_ver=${vtBsdVerNum}.x
507 elif vt_strstr "${chosen_path}" "MidnightBSD"; then
508 set vt_freebsd_ver=9.x
512 if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
513 set vtFreeBsdDistro=ClonOS
516 set vt_freebsd_bit=64
517 for file in "/boot/kernel/kernel" "/boot/kernel/kernel.gz"; do
518 if [ -e (loop)/$file ]; then
519 if file --is-i386-kfreebsd (loop)/$file; then
520 set vt_freebsd_bit=32
526 if [ "$vt_freebsd_ver" = "xx" ]; then
527 if [ -e (loop)/boot/kernel/kernel ]; then
528 vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel $vt_freebsd_bit vt_freebsd_ver
529 elif [ -e (loop)/boot/kernel/kernel.gz ]; then
530 vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel.gz $vt_freebsd_bit vt_freebsd_ver
533 if [ "$vt_freebsd_ver" = "xx" ]; then
534 set vt_freebsd_ver=14.x
538 if [ "$vt_freebsd_ver" = "14.x" ]; then
539 if [ -e (loop)/boot/lua/brand-pfSense.lua ]; then
540 set vtFreeBsdDistro=pfSense
545 if [ -n "${vtdebug_flag}" ]; then
546 echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
549 unset vt_unix_mod_path
550 for file in "/COPYRIGHT" "/FreeNAS-MANIFEST" "/TrueNAS-MANIFEST" "/version" "/etc/fstab"; do
551 if [ -e (loop)${file} ]; then
552 set vt_unix_mod_path=${file}
557 if [ -n "$vt_unix_mod_path" ]; then
558 vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
559 vt_unix_replace_conf FreeBSD "${1}${chosen_path}"
560 elif [ -e (loop)/easyre.ufs.uzip ]; then
561 vt_unix_replace_ko "/boot/grub/i386-pc/linux.mod" (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
562 if [ "$grub_platform" = "pc" ]; then
563 vt_unix_replace_grub_conf "/boot/grub/i386-pc/linux.mod" "cd9"
565 vt_unix_replace_conf FreeBSD "${1}${chosen_path}" "cd9"
570 function ventoy_dragonfly_proc {
572 unset vt_unix_mod_path
573 for file in "/boot/kernel/initrd.img.gz"; do
574 if [ -e (loop)${file} ]; then
575 set vt_unix_mod_path=${file}
580 vt_unix_replace_ko $vt_unix_mod_path ${vtoy_path}/dragonfly.mfs.xz
581 vt_unix_fill_image_desc
583 vt_unix_replace_conf DragonFly "${1}${chosen_path}"
586 function ventoy_unix_comm_proc {
589 vt_unix_check_vlnk "${1}${chosen_path}"
591 if [ "$ventoy_compatible" = "NO" ]; then
592 loopback vtunix $vtoy_efi_part/ventoy/ventoy_unix.cpio
594 if [ "$vt_unix_type" = "FreeBSD" ]; then
595 ventoy_freebsd_proc "$1" "${chosen_path}"
596 elif [ "$vt_unix_type" = "DragonFly" ]; then
597 ventoy_dragonfly_proc "$1" "${chosen_path}"
598 elif [ "$vt_unix_type" = "NetBSD" ]; then
599 echo "NetBSD not supported"
603 if [ -n "${vtdebug_flag}" ]; then
604 echo "Unknown unix type"
609 vt_unix_chain_data "${1}${chosen_path}"
614 function uefi_windows_menu_func {
617 unset vt_cur_wimboot_mode
618 if vt_check_mode 4 "$vt_chosen_name"; then
619 set vt_cur_wimboot_mode=1
622 if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
623 if [ "$ventoy_fs_probe" = "iso9660" ]; then
625 vt_iso9660_nojoliet 1
629 for file in "efi/microsoft/boot/bcd"; do
630 vt_windows_collect_wim_patch bcd (loop)/$file
633 vt_windows_count_wim_patch vt_wim_cnt
634 if [ $vt_wim_cnt -eq 0 ]; then
635 distro_specify_wim_patch_phase2
639 locate_wim "${chosen_path}"
642 vt_windows_chain_data "${1}${chosen_path}"
645 if [ "$vt_cur_wimboot_mode" = "1" ]; then
649 if [ -n "$vtoy_chain_mem_addr" ]; then
650 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
651 ventoy_max_resolution
652 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} iso_${ventoy_fs_probe} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
655 echo "chain empty failed"
660 function uefi_find_replace_initrd {
661 if vt_get_efi_vdisk_offset "${1}${2}" vt_efivdisk_offset; then
662 loopback -s $vt_efivdisk_offset vtefivdisk "${1}${2}"
665 vt_search_replace_initrd (vtefivdisk) vt_rp_initrd
667 if [ -n "$vt_rp_initrd" ]; then
668 vt_add_replace_file $3 "$vt_rp_initrd"
671 loopback -d vtefivdisk
676 function uefi_linux_menu_func {
678 if [ "$ventoy_compatible" = "NO" ]; then
680 if [ "$ventoy_fs_probe" = "udf" ]; then
682 set ventoy_fs_probe=iso9660
686 vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"
688 vt_linux_clear_initrd
690 if [ -d (loop)/pmagic ]; then
691 vt_linux_specify_initrd_file /pmagic/initrd.img
693 for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg" "EFI/BOOT/grub/grub.cfg"; do
694 if [ -e (loop)/$file ]; then
695 vt_linux_parse_initrd_grub file (loop)/$file
700 # special process for special distros
701 if [ -d (loop)/loader/entries ]; then
702 vt_linux_parse_initrd_grub dir (loop)/loader/entries/
703 elif [ -d (loop)/boot/grub ]; then
704 vt_linux_parse_initrd_grub dir (loop)/boot/grub/
707 distro_specify_initrd_file
709 vt_linux_initrd_count vtcount
711 if [ $vtcount -eq 0 ]; then
712 if [ -e (loop)/EFI/boot/livegrub.cfg ]; then
713 vt_linux_parse_initrd_grub file (loop)/EFI/boot/livegrub.cfg
715 distro_specify_initrd_file_phase2
717 if [ "$vt_efi_dir" = "NO" ]; then
718 if [ -f (loop)/efi.img ]; then
719 vt_add_replace_file 0 "initrd"
726 if [ -d (loop)/loader/entries ]; then
727 vt_linux_get_main_initrd_index vtindex
729 if [ -d (loop)/arch ]; then
730 if [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
731 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
732 elif [ -f (loop)/arch/boot/x86_64/initramfs-linux.img ]; then
733 vt_add_replace_file $vtindex "arch\\boot\\x86_64\\initramfs-linux.img"
734 elif [ -f (loop)/boot/initramfs_x86_64.img ]; then
735 vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img"
737 elif [ -d (loop)/blackarch ]; then
738 if [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
739 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
740 elif [ -f (loop)/blackarch/boot/x86_64/initramfs-linux.img ]; then
741 vt_add_replace_file $vtindex "blackarch\\boot\\x86_64\\initramfs-linux.img"
743 elif [ -d (loop)/anarchy ]; then
744 if [ -f (loop)/anarchy/boot/x86_64/initramfs-linux.img ]; then
745 vt_add_replace_file $vtindex "anarchy\\boot\\x86_64\\initramfs-linux.img"
747 elif [ -d (loop)/parabola ]; then
748 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
749 vt_add_replace_file $vtindex "EFI\\parabolaiso\\parabolaiso.img"
750 elif [ -f (loop)/parabola/boot/x86_64/initramfs-linux-libre.img ]; then
751 vt_add_replace_file $vtindex "parabola\\boot\\x86_64\\initramfs-linux-libre.img"
753 elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
754 vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
755 elif [ -f (loop)/loader/entries/thinstation.conf ]; then
756 vt_add_replace_file $vtindex "boot\\initrd"
757 elif [ -f (loop)/loader/entries/pisi-efi-x86_64.conf ]; then
758 vt_add_replace_file $vtindex "EFI\\pisi\\initrd.img"
761 vt_get_replace_file_cnt vt_replace_cnt
762 if [ $vt_replace_cnt -eq 0 ]; then
763 uefi_find_replace_initrd "$1" "$2" $vtindex
765 elif [ -d (loop)/EFI/boot/entries ]; then
766 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
767 vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
768 elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
769 vt_add_replace_file 0 "EFI\\hyperiso\\hyperiso.img"
771 elif [ -d (loop)/EFI/BOOT/entries ]; then
772 vt_linux_get_main_initrd_index vtindex
774 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
775 vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
776 elif [ -f (loop)/parabola/boot/x86_64/initramfs-linux-libre.img ]; then
777 vt_add_replace_file $vtindex "parabola\\boot\\x86_64\\initramfs-linux-libre.img"
779 elif [ -e (loop)/syslinux/alt0/full.cz ]; then
780 vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
781 set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
783 elif vt_str_begin "$vt_volume_id" "SolusLive"; then
784 vt_add_replace_file 0 "initrd"
790 vt_linux_chain_data "${1}${chosen_path}"
792 if [ -n "$LoadIsoEfiDriver" -a $vt_chosen_size -LT 104857600 ]; then
793 if [ -f (loop)/efi/clover/cloverx64.efi ]; then
794 unset LoadIsoEfiDriver
798 if [ -n "$vtoy_chain_mem_addr" ]; then
799 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
803 if vt_check_mode 3 "$vt_chosen_name"; then
805 elif vt_str_begin "$vt_volume_id" "HOLO_"; then
806 if [ -d (loop)/loader/entries ]; then
809 elif vt_str_begin "$vt_volume_id" "KRD"; then
810 if [ -f (loop)/boot/grub/grub.cfg.sig ]; then
815 if [ -n "$vtGrub2Mode" ]; then
818 if [ "$VTOY_EFI_ARCH" != "mips" ]; then
819 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi fallback env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
825 set vtback_root=$root
827 set vtback_theme=$theme
830 vt_trailer_cpio "$vtoy_iso_part" "$vt_chosen_path" noinit
831 vt_set_boot_opt rdinit=/vtoy/vtoy
834 set vtback_cfg_find=0
835 for cfg in "/boot/grub/grub.cfg" "/EFI/BOOT/grub.cfg" "/EFI/debian/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "/grub/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
836 if [ -e "$cfg" ]; then
837 set vtback_cfg_find=1
842 if [ $vtback_cfg_find -eq 0 ]; then
843 if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then
844 if vt_str_begin "$vt_volume_id" "HOLO_"; then
846 vt_systemd_menu (loop,2) vt_sys_menu_mem
848 vt_systemd_menu (loop) vt_sys_menu_mem
850 set vtback_cfg_find=1
851 configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
855 if [ $vtback_cfg_find -eq 0 ]; then
856 if [ -f (loop)/boot/isolinux/syslnx64.cfg ]; then
857 syslinux_configfile (loop)/boot/isolinux/syslnx64.cfg
858 set vtback_cfg_find=1
859 elif [ -f (loop)/boot/syslinux/porteus.cfg ]; then
860 syslinux_configfile (loop)/boot/syslinux/porteus.cfg
861 set vtback_cfg_find=1
865 if [ "$vtback_cfg_find" = "0" ]; then
867 echo "No bootfile found for UEFI!"
868 echo "Maybe the image does not support $VTOY_EFI_ARCH UEFI"
874 set root=$vtback_root
875 set theme=$vtback_theme
879 echo "chain empty failed"
884 function uefi_unix_menu_func {
885 ventoy_unix_comm_proc $1 "${chosen_path}"
887 if [ -n "$vtoy_chain_mem_addr" ]; then
888 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
890 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
893 echo "chain empty failed"
898 function ventoy_reset_nojoliet {
899 if vt_str_begin "$vt_volume_id" "ARCARESCUE"; then
900 vt_iso9660_nojoliet 1
902 vt_iso9660_nojoliet 0
905 vt_append_extra_sector 0
908 function uefi_iso_menu_func {
909 if [ -n "$vtisouefi" ]; then
910 set LoadIsoEfiDriver=on
912 elif vt_check_mode 2 "$vt_chosen_name"; then
913 set LoadIsoEfiDriver=on
915 unset LoadIsoEfiDriver
919 vt_select_auto_install "${chosen_path}"
920 vt_select_persistence "${chosen_path}"
922 if ! vt_is_udf "${1}${chosen_path}"; then
923 # Lenovo EasyStartup need an addional sector for boundary check
924 if vt_str_begin "$vt_volume_id" "EasyStartup"; then
925 vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
926 vt_append_extra_sector 1
930 if [ -d (loop)/EFI ]; then
932 elif [ -d (loop)/efi ]; then
938 if [ -n "$vtcompat" ]; then
939 set ventoy_compatible=YES
941 elif vt_check_mode 1 "$vt_chosen_name"; then
942 set ventoy_compatible=YES
944 vt_check_compatible (loop)
947 vt_img_sector "${1}${chosen_path}"
949 if [ "$ventoy_fs_probe" = "iso9660" ]; then
950 vt_select_conf_replace "${1}" "${chosen_path}"
953 if [ "$vtoy_os" = "Windows" ]; then
954 vt_check_compatible_pe (loop)
955 uefi_windows_menu_func "$1" "${chosen_path}"
956 elif [ "$vtoy_os" = "Unix" ]; then
957 uefi_unix_menu_func "$1" "${chosen_path}"
959 vt_check_compatible_linux (loop)
960 uefi_linux_menu_func "$1" "${chosen_path}"
966 function uefi_iso_memdisk {
967 echo 'Loading ISO file to memory ...'
968 vt_load_img_memdisk "${1}${2}" vtoy_iso_buf
971 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
977 function vtoy_windows_wimboot {
978 if [ -f (loop)/x86/sources/boot.wim -a -f (loop)/x64/sources/boot.wim ]; then
979 vt_sel_wimboot vtoy_wimboot_bit
980 if [ "$vtoy_wimboot_bit" = "32" ]; then
981 set vtoy_wimboot_prefix=(loop)/x86
983 set vtoy_wimboot_prefix=(loop)/x64
986 set vtoy_wimboot_prefix=(loop)
987 if vt_is_pe64 $vtoy_wimboot_prefix/setup.exe; then
988 set vtoy_wimboot_bit=64
990 set vtoy_wimboot_bit=32
994 if [ -n "${vtdebug_flag}" ]; then
995 echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit vt_wimkernel=$vt_wimkernel
998 vt_windows_wimboot_data "$vtoy_wimboot_prefix/sources/boot.wim" vtoy_init_exe vtoy_wim_bit
1000 if [ "$grub_platform" = "pc" ]; then
1001 linux16 "$vtoy_path/$vt_wimkernel" quiet
1004 vt_set_wim_load_prompt 1 "Loading files......"
1005 initrd16 newc:winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
1006 newc:vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd \
1007 newc:bcd:$vtoy_wimboot_prefix/boot/bcd \
1008 newc:boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi \
1009 newc:boot.wim:$vtoy_wimboot_prefix/sources/boot.wim
1010 vt_set_wim_load_prompt 0
1013 vt_set_wim_load_prompt 1 "Loading files......"
1014 vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/sources/boot.wim vtoy_wimfile_mem
1015 vt_set_wim_load_prompt 0
1017 if [ $? -eq 0 ]; then
1018 set vtoy_wimfile_path=mem:${vtoy_wimfile_mem_addr}:size:${vtoy_wimfile_mem_size}
1020 set vtoy_wimfile_path=$vtoy_wimboot_prefix/sources/boot.wim
1024 chainloader "$vtoy_path/$vt_wimkernel" quiet \
1025 "vf=winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
1026 "vf=vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd" \
1027 "vf=bcd:$vtoy_wimboot_prefix/boot/bcd" \
1028 "vf=boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi" \
1029 "vf=boot.wim:$vtoy_wimfile_path" \
1030 pfsize=$vtoy_chain_file_size \
1031 pfread=$vtoy_chain_file_read
1037 function vtoy_winpe_wimboot {
1038 unset vtoy_boot_sdi_legacy
1039 unset vtoy_boot_sdi_efi
1041 set vtoy_wimboot_prefix=(loop)
1042 set vtoy_wim_path="$1"
1044 if [ -n "${vtdebug_flag}" ]; then
1045 echo "winpe_wimboot $1 $2 $3"
1048 if [ "$2" != "0" ]; then
1049 set vtoy_boot_sdi_legacy="newc:boot.sdi:$vtoy_wimboot_prefix/$2"
1050 set vtoy_boot_sdi_efi="vf=boot.sdi:$vtoy_wimboot_prefix/$2"
1053 vt_windows_wimboot_data $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_init_exe vtoy_wim_bit
1055 if [ "$grub_platform" = "pc" ]; then
1056 linux16 "$vtoy_path/$vt_wimkernel" quiet
1059 vt_set_wim_load_prompt 1 "Loading files......"
1060 initrd16 newc:$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
1061 newc:vtoy_wimboot:$vtoy_path/$vt_wimkernel \
1062 newc:bootmgr.exe:mem:${vtoy_pe_bootmgr_mem_addr}:size:${vtoy_pe_bootmgr_mem_size} \
1063 newc:bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size} \
1064 $vtoy_boot_sdi_legacy \
1065 newc:boot.wim:$vtoy_wimboot_prefix/$vtoy_wim_path
1066 vt_set_wim_load_prompt 0
1069 if [ "$VTOY_EFI_ARCH" = "x64" -a "$vtoy_wim_bit" = "32" ]; then
1070 echo -e "\nThis is 32bit Windows and does NOT support x86_64 UEFI firmware.\n"
1071 echo -e "这是32位的 Windows 系统,不支持当前的64位 UEFI 环境。\n"
1074 vt_set_wim_load_prompt 1 "Loading files......"
1075 vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_wimfile_mem
1076 vt_set_wim_load_prompt 0
1078 if [ $? -eq 0 ]; then
1079 set vtoy_wimfile_path=mem:${vtoy_wimfile_mem_addr}:size:${vtoy_wimfile_mem_size}
1081 set vtoy_wimfile_path=$vtoy_wimboot_prefix/$vtoy_wim_path
1084 unset vtoy_boot_efi_path
1085 if [ -F (loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi ]; then
1086 set vtoy_boot_efi_path="vf=bootx64.efi:(loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi"
1090 chainloader "$vtoy_path/$vt_wimkernel" quiet \
1091 "vf=$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
1092 "vf=vtoy_wimboot:$vtoy_path/$vt_wimkernel" \
1093 "vf=bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size}" \
1094 "$vtoy_boot_sdi_efi" \
1095 "$vtoy_boot_efi_path" \
1096 "vf=boot.wim:$vtoy_wimfile_path" \
1097 pfsize=$vtoy_chain_file_size \
1098 pfread=$vtoy_chain_file_read
1104 function vtoy_wimboot_func {
1105 if [ "$grub_platform" = "pc" ]; then
1106 set vt_wimkernel=wimboot.x86_64.xz
1108 if [ "$grub_cpu" = "i386" ]; then
1109 set vt_wimkernel=wimboot.i386.efi.xz
1111 set vt_wimkernel=wimboot.x86_64.xz
1115 if vt_is_standard_winiso (loop); then
1116 echo -e "\n==================== VENTOY WIMBOOT ==================\n"
1117 vtoy_windows_wimboot
1119 vt_sel_winpe_wim (loop)
1120 if [ -n "$vtoy_pe_wim_path" ]; then
1121 echo -e "\n==================== VENTOY WIMBOOT ==================\n"
1124 vt_load_file_to_mem "auto" $vtoy_path/common_bcd.xz vtoy_pe_bcd_mem
1127 for vsdi in "boot/boot.sdi" "2K10/FONTS/boot.sdi" "SSTR/boot.sdi" "ISPE/BOOT.SDI" \
1128 "boot/uqi.sdi" "ISYL/boot.sdi" "WEPE/WEPE.SDI" ; do
1129 if [ -F "(loop)/$vsdi" ]; then
1130 set vt_sdi_path=$vsdi
1135 if [ "$grub_platform" = "pc" ]; then
1136 vt_load_file_to_mem "auto" $vtoy_path/common_bootmgr.xz vtoy_pe_bootmgr_mem
1137 vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 1
1139 vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 0
1147 function legacy_windows_menu_func {
1150 unset vt_cur_wimboot_mode
1151 if vt_check_mode 4 "$vt_chosen_name"; then
1152 set vt_cur_wimboot_mode=1
1155 if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
1156 if [ "$ventoy_fs_probe" = "iso9660" ]; then
1158 vt_iso9660_nojoliet 1
1159 loopback loop "$1$2"
1162 for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD" "boot/bce"; do
1163 vt_windows_collect_wim_patch bcd (loop)/$file
1166 distro_specify_wim_patch
1168 vt_windows_count_wim_patch vt_wim_cnt
1169 if [ $vt_wim_cnt -eq 0 ]; then
1170 distro_specify_wim_patch_phase2
1174 if [ -z "$vt_cur_wimboot_mode" ]; then
1175 locate_wim "${chosen_path}"
1179 vt_windows_chain_data "${1}${chosen_path}"
1182 if [ "$vt_cur_wimboot_mode" = "1" ]; then
1186 if [ -n "$vtoy_chain_mem_addr" ]; then
1187 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1188 if [ "$ventoy_compatible" = "NO" ]; then
1189 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1191 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1195 echo "chain empty failed"
1200 function legacy_linux_menu_func {
1201 if [ "$ventoy_compatible" = "NO" ]; then
1203 if [ "$ventoy_fs_probe" = "udf" ]; then
1205 set ventoy_fs_probe=iso9660
1206 loopback loop "$1$2"
1210 if vt_syslinux_need_nojoliet "$1$2"; then
1211 vt_iso9660_nojoliet 1
1213 loopback loop "$1$2"
1216 vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"
1218 vt_linux_clear_initrd
1220 if [ -d (loop)/pmagic ]; then
1221 vt_linux_specify_initrd_file /pmagic/initrd.img
1223 for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
1224 if [ -d (loop)/$dir ]; then
1225 vt_linux_parse_initrd_isolinux (loop)/$dir/
1230 # special process for special distros
1232 if [ -d (loop)/arch/boot/syslinux ]; then
1233 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
1234 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
1235 elif [ -d (loop)/anarchy/boot/syslinux ]; then
1236 vt_linux_parse_initrd_isolinux (loop)/anarchy/boot/syslinux/ /anarchy/
1239 elif [ -d (loop)/manjaro ]; then
1240 if [ -e (loop)/boot/grub/kernels.cfg ]; then
1241 vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
1243 elif [ -e (loop)/boot/grub/grub.cfg ]; then
1244 vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
1247 distro_specify_initrd_file
1249 vt_linux_initrd_count vtcount
1250 if [ $vtcount -eq 0 ]; then
1251 if [ -d (loop)/rancheros ]; then
1252 vt_linux_parse_initrd_isolinux (loop)/boot/ /boot/isolinux/
1255 distro_specify_initrd_file_phase2
1261 vt_linux_chain_data "${1}${chosen_path}"
1264 if [ -n "$vtoy_chain_mem_addr" ]; then
1266 if vt_check_mode 3 "$vt_chosen_name"; then
1268 elif vt_str_begin "$vt_volume_id" "HOLO_"; then
1269 if [ -d (loop)/loader/entries ]; then
1274 if [ -n "$vtGrub2Mode" ]; then
1275 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1279 set vtback_root=$root
1281 set vtback_theme=$theme
1284 vt_trailer_cpio "$vtoy_iso_part" "$vt_chosen_path" noinit
1285 vt_set_boot_opt rdinit=/vtoy/vtoy
1288 set vtback_cfg_find=0
1289 for cfg in "/boot/grub/grub.cfg" "/EFI/BOOT/grub.cfg" "/EFI/debian/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "/grub/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
1290 if [ -e "$cfg" ]; then
1291 set vtback_cfg_find=1
1296 if [ $vtback_cfg_find -eq 0 ]; then
1297 if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then
1298 if vt_str_begin "$vt_volume_id" "HOLO_"; then
1300 vt_systemd_menu (loop,2) vt_sys_menu_mem
1302 vt_systemd_menu (loop) vt_sys_menu_mem
1304 set vtback_cfg_find=1
1305 configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
1309 if [ $vtback_cfg_find -eq 0 ]; then
1310 if [ -f (loop)/boot/isolinux/syslnx64.cfg ]; then
1311 syslinux_configfile (loop)/boot/isolinux/syslnx64.cfg
1312 set vtback_cfg_find=1
1313 elif [ -f (loop)/boot/syslinux/porteus.cfg ]; then
1314 syslinux_configfile (loop)/boot/syslinux/porteus.cfg
1315 set vtback_cfg_find=1
1320 set root=$vtback_root
1321 set theme=$vtback_theme
1325 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1326 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1330 echo "chain empty failed"
1336 function legacy_unix_menu_func {
1337 ventoy_unix_comm_proc $1 "${chosen_path}"
1339 if [ -n "$vtoy_chain_mem_addr" ]; then
1340 #ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1341 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1344 echo "chain empty failed"
1350 function legacy_iso_menu_func {
1351 set chosen_path="$2"
1353 vt_select_auto_install "${chosen_path}"
1354 vt_select_persistence "${chosen_path}"
1356 if [ -n "$vtcompat" ]; then
1357 set ventoy_compatible=YES
1359 elif vt_check_mode 1 "$vt_chosen_name"; then
1360 set ventoy_compatible=YES
1362 vt_check_compatible (loop)
1365 vt_img_sector "${1}${chosen_path}"
1367 if [ "$ventoy_fs_probe" = "iso9660" ]; then
1368 vt_select_conf_replace "${1}" "${chosen_path}"
1371 if [ "$vtoy_os" = "Windows" ]; then
1372 vt_check_compatible_pe (loop)
1373 legacy_windows_menu_func "$1" "${chosen_path}"
1374 elif [ "$vtoy_os" = "Unix" ]; then
1375 legacy_unix_menu_func "$1" "${chosen_path}"
1377 vt_check_compatible_linux (loop)
1378 legacy_linux_menu_func "$1" "${chosen_path}"
1380 vt_secondary_recover_mode
1383 function legacy_iso_memdisk {
1385 linux16 $vtoy_path/memdisk iso raw
1386 echo "Loading ISO file to memory ..."
1392 function iso_endless_os_proc {
1393 if [ -d (loop)/ ]; then
1397 loopback loop "${1}${2}"
1398 vt_img_sector "${1}${2}"
1400 vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"
1401 vt_trailer_cpio "$1" "$2" noinit
1405 vt_set_boot_opt '@kparams' rdinit=/vtoy/vtoy
1408 set ventoy_bls_bootdev=/boot
1409 set ventoy_loading_tip="Loading files ......"
1412 configfile (loop)/endless/grub/grub.cfg
1415 unset ventoy_bls_bootdev
1416 unset ventoy_loading_tip
1422 function ventoy_iso_busybox_ver {
1424 if [ "$VTOY_EFI_ARCH" = "aa64" ]; then
1425 set ventoy_busybox_ver=a64
1426 elif [ "$VTOY_EFI_ARCH" = "mips" ]; then
1427 set ventoy_busybox_ver=m64
1429 set ventoy_busybox_ver=32
1431 #special process for deepin-live iso
1432 if [ "$vt_chosen_size" = "403701760" ]; then
1433 if vt_str_str "$vt_chosen_path" "/deepin-live"; then
1434 set ventoy_busybox_ver=64
1436 elif vt_str_begin "$vt_volume_id" "PHOTON_"; then
1437 set ventoy_busybox_ver=64
1438 elif vt_str_begin "$vt_volume_id" "smgl-test-quinq-x86_64"; then
1439 set ventoy_busybox_ver=64
1440 elif vt_str_begin "$vt_volume_id" "LDiagBootable"; then
1441 set ventoy_busybox_ver=64
1442 elif vt_str_begin "$vt_volume_id" "KAOS_"; then
1443 set ventoy_busybox_ver=64
1450 function iso_common_menuentry {
1454 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1456 vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space
1457 if [ $vt_volume_space -NE $vt_chosen_size ]; then
1458 vt_mod $vt_chosen_size 2048 vt_chosen_size_mod
1459 if [ $vt_chosen_size_mod -ne 0 ]; then
1460 echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n"
1461 echo -e "\n The size of the iso file \"$vt_chosen_size\" is invalid. File corrupted ?\n"
1462 echo -e " 此ISO文件的大小 \"$vt_chosen_size\" 有问题,请确认文件是否损坏。\n"
1463 echo -en "\n$VTLANG_ENTER_CONTINUE ..."
1468 if vt_check_password "${vt_chosen_path}"; then
1472 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1478 #secondary boot menu
1479 if vt_is_udf "${vtoy_iso_part}${vt_chosen_path}"; then
1480 set ventoy_fs_probe=udf
1482 set ventoy_fs_probe=iso9660
1483 ventoy_reset_nojoliet
1486 if [ -d (loop)/ ]; then
1489 loopback loop "${vtoy_iso_part}${vt_chosen_path}"
1495 if vt_need_secondary_menu "$vt_chosen_name"; then
1496 vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
1497 if [ "$VTOY_SECOND_EXIT" = "1" ]; then
1503 if vt_str_begin "$vt_volume_id" "Avira"; then
1504 vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
1507 ventoy_iso_busybox_ver
1509 #special process for Endless OS
1510 if vt_str_begin "$vt_volume_id" "Endless-OS"; then
1511 iso_endless_os_proc $vtoy_iso_part "$vt_chosen_path"
1512 elif vt_str_begin "$vt_volume_id" "TENS-Public"; then
1517 # auto memdisk mode for some special ISO files
1518 vt_iso_vd_id_parse "${vtoy_iso_part}${vt_chosen_path}"
1520 if vt_check_mode 0 "$vt_chosen_name"; then
1523 if [ "$grub_platform" = "pc" ]; then
1524 if vt_iso_vd_id_begin 1 0 "Memtest86+"; then
1526 elif vt_iso_vd_id_begin 0 1 "KolibriOS"; then
1532 if [ $vt_chosen_size -LE 67108864 ]; then
1533 if vt_str_begin "$vt_chosen_name" "iKuai"; then
1541 if [ "$grub_platform" = "pc" ]; then
1542 if [ -n "$vtMemDiskBoot" ]; then
1543 legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1545 legacy_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
1548 if [ -n "$vtMemDiskBoot" ]; then
1549 uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1551 uefi_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
1555 vt_secondary_recover_mode
1558 function miso_common_menuentry {
1559 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1561 if vt_check_password "${vt_chosen_path}"; then
1565 echo "memdisk mode boot for $vt_chosen_path"
1569 if [ "$grub_platform" = "pc" ]; then
1570 legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1572 uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1577 function common_unsupport_menuentry {
1578 echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
1579 echo -e " 文件名中不能有中文或空格 \n"
1580 echo -en "\n$VTLANG_ENTER_EXIT ..."
1584 function miso_unsupport_menuentry {
1585 common_unsupport_menuentry
1588 function iso_unsupport_menuentry {
1589 common_unsupport_menuentry
1592 function wim_common_menuentry {
1593 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1595 if vt_check_password "${vt_chosen_path}"; then
1599 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1603 if vt_wim_check_bootable "${vtoy_iso_part}${vt_chosen_path}"; then
1604 vt_wim_chain_data "${vtoy_iso_part}${vt_chosen_path}"
1606 echo -e "\n This is NOT a bootable WIM file. \n"
1607 echo -e " 这不是一个可启动的 WIM 文件。\n"
1612 if [ -n "$vtoy_chain_mem_addr" ]; then
1613 if [ "$grub_platform" = "pc" ]; then
1614 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1617 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1622 echo "chain empty failed"
1627 function wim_unsupport_menuentry {
1628 common_unsupport_menuentry
1631 function efi_common_menuentry {
1632 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1634 if vt_check_password "${vt_chosen_path}"; then
1638 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1643 if vt_is_vlnk_name "${vt_chosen_path}"; then
1644 vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
1645 if [ -z "$vt_vlnk_dst" ]; then
1646 echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
1651 vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
1658 #first try with chainload
1660 set root=$vtoy_iso_part
1661 chainloader "${vt_vlnk_dst}"
1666 vt_concat_efi_iso "${vt_vlnk_dst}" vtoy_iso_buf
1667 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} dotefi isoefi=on ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
1673 function efi_unsupport_menuentry {
1674 common_unsupport_menuentry
1677 function vhdboot_common_func {
1678 vt_patch_vhdboot "$1"
1682 if [ -n "$vtoy_vhd_buf_addr" ]; then
1683 if [ "$grub_platform" = "pc" ]; then
1685 linux16 $vtoy_path/memdisk iso raw
1686 initrd16 mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
1691 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
1696 echo "Please put the right ventoy_vhdboot.img file to the 1st partition"
1701 function vhd_common_menuentry {
1702 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1704 if vt_check_password "${vt_chosen_path}"; then
1708 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1713 if vt_is_vlnk_name "${vt_chosen_path}"; then
1714 vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
1715 if [ -z "$vt_vlnk_dst" ]; then
1716 echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
1721 vt_vlnk_dst="${vt_chosen_path}"
1722 if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
1723 if [ "$vtoy_iso_fs" != "ntfs" ]; then
1724 echo -e "!!! WARNING !!!\n"
1725 echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
1726 echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
1727 echo -en "\n$VTLANG_ENTER_CONTINUE ..."
1733 vhdboot_common_func "${vt_vlnk_dst}"
1736 function vhd_unsupport_menuentry {
1737 common_unsupport_menuentry
1740 function vtoyboot_common_func {
1744 vt_get_vtoy_type "${1}" vtoytype parttype AltBootPart
1746 if vt_str_begin $vtoytype vhd; then
1748 elif [ "$vtoytype" = "raw" ]; then
1750 elif [ "$vtoytype" = "vdi" ]; then
1754 if [ $vtoysupport -eq 1 ]; then
1755 if [ "$grub_platform" = "pc" ]; then
1756 if [ "$parttype" = "gpt" -a $AltBootPart -eq 0 ]; then
1757 echo "The OS in the vdisk was created in UEFI mode, but current is Legacy BIOS mode."
1758 echo "虚拟磁盘内的系统是在UEFI模式下创建的,而当前系统是Legacy BIOS模式,可能无法正常启动。"
1762 if [ "$parttype" = "mbr" -a $AltBootPart -eq 0 ]; then
1763 echo "The OS in the vdisk was created in Legacy BIOS mode, but current is UEFI mode."
1764 echo "虚拟磁盘内的系统是在Legacy BIOS模式下创建的,而当前系统是UEFI模式,可能无法正常启动。"
1769 vt_img_sector "${1}"
1770 vt_raw_chain_data "${1}"
1774 if [ -n "$vtoy_chain_mem_addr" ]; then
1775 if [ "$grub_platform" = "pc" ]; then
1776 vt_acpi_param ${vtoy_chain_mem_addr} 512
1777 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} bios80 sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1780 if vt_check_secureboot_var; then
1781 vt_acpi_param ${vtoy_chain_mem_addr} 512
1784 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi sector512 env_param=${ventoy_env_param} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1789 echo "chain empty failed!"
1793 echo "Unsupported vtoy type $vtoytype"
1798 function vtoy_common_menuentry {
1799 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1801 if vt_check_password "${vt_chosen_path}"; then
1805 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1810 if vt_is_vlnk_name "${vt_chosen_path}"; then
1811 vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
1812 if [ -z "$vt_vlnk_dst" ]; then
1813 echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
1818 vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
1821 vtoyboot_common_func "${vt_vlnk_dst}"
1824 function vtoy_unsupport_menuentry {
1825 common_unsupport_menuentry
1829 #============================================================#
1830 # IMG file boot process #
1831 #============================================================#
1834 function only_uefi_tip {
1835 echo -e "\n This IMG file is only supported in UEFI mode. \n"
1836 echo -en "\n$VTLANG_ENTER_EXIT ..."
1840 function ventoy_img_easyos {
1841 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1842 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1844 loopback easysfs (vtimghd,1)/easy.sfs
1845 vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
1847 if [ -n "$vt_module_ver" ]; then
1848 for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
1849 if [ -e (easysfs)/lib/modules/$vt_module_ver/$mod ]; then
1850 vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
1858 vt_set_boot_opt rdinit=/vtoy/vtoy
1861 syslinux_configfile (vtimghd,1)/syslinux.cfg
1868 function ventoy_img_easyos2 {
1869 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1870 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1872 if [ -e (vtimghd,2)/easyos/easy.sfs ]; then
1873 loopback easysfs (vtimghd,2)/easyos/easy.sfs
1874 elif [ -d (vtimghd,2)/easyos/releases ]; then
1875 vt_fs_enum_1st_dir (vtimghd,2) /easyos/releases/ vt_dir_name
1876 loopback easysfs (vtimghd,2)/easyos/releases/$vt_dir_name/easy.sfs
1879 vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
1881 if [ -n "$vt_module_ver" ]; then
1882 for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
1883 if [ -e (easysfs)/lib/modules/$vt_module_ver/$mod ]; then
1884 vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
1892 vt_set_boot_opt rdinit=/vtoy/vtoy
1895 vt_limine_menu (vtimghd,1)/limine.cfg vt_sys_menu_mem
1896 configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
1903 function ventoy_img_volumio {
1904 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1905 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1910 vt_set_boot_opt rdinit=/vtoy/vtoy imgpart=/dev/ventoy2 bootpart=/dev/ventoy1
1913 syslinux_configfile (vtimghd,1)/syslinux.cfg
1919 function ventoy_img_openelec {
1922 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1923 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1925 loopback vtloopex $vtoy_efi_part/ventoy/vtloopex.cpio
1926 vt_img_extra_initrd_append (vtloopex)/$elec_ver/vtloopex.tar.xz
1928 if [ "$elec_ver" = "LibreELEC" ]; then
1929 if [ -f (vtimghd,1)/system ]; then
1930 loopback elecsfs (vtimghd,1)/system
1931 vt_get_lib_module_ver (elecsfs) /usr/lib/kernel-overlays/base/lib/modules/ vt_module_ver
1932 if [ -n "$vt_module_ver" ]; then
1933 for mod in "kernel/drivers/md/dm-mod.ko"; do
1934 if [ -e (elecsfs)/usr/lib/kernel-overlays/base/lib/modules/$vt_module_ver/$mod ]; then
1935 vt_img_extra_initrd_append (elecsfs)/usr/lib/kernel-overlays/base/lib/modules/$vt_module_ver/$mod
1945 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=$elec_ver
1948 set root=(vtimghd,1)
1949 syslinux_configfile (vtimghd,1)/syslinux.cfg
1953 loopback -d vtloopex
1958 function ventoy_img_freedombox {
1959 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1960 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1962 vt_get_lib_module_ver (vtimghd,1) /lib/modules/ vt_module_ver
1963 if [ -n "$vt_module_ver" ]; then
1964 vt_img_extra_initrd_append (vtimghd,1)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
1970 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=freedombox
1973 configfile (vtimghd,1)/boot/grub/grub.cfg
1979 function ventoy_img_paldo {
1980 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1981 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1986 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=paldo
1989 vt_fs_enum_1st_file (vtimghd,1) /loader/entries/ vt_paldo_entry_conf
1990 vt_file_basename $vt_paldo_entry_conf vtPaldoVer
1992 echo loading file...
1993 linux (vtimghd,1)/linux-${vtPaldoVer} root=/dev/ventoy1 rootfstype=vfat
1994 initrd (vtimghd,1)/initramfs-${vtPaldoVer}
2001 function ventoy_img_ubos {
2002 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2003 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2005 vt_get_lib_module_ver (vtimghd,3) /lib/modules/ vt_module_ver
2006 if [ -n "$vt_module_ver" ]; then
2007 vt_img_extra_initrd_append (vtimghd,3)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko.xz
2013 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=ubos
2016 echo loading file...
2017 linux (vtimghd,2)/vmlinuz-linux root=/dev/ventoy3 rw
2018 initrd (vtimghd,2)/initramfs-linux.img
2025 function ventoy_img_recalbox {
2026 if [ $vtoy_img_max_part_end -GT $vt_chosen_size ]; then
2027 echo -e "\nPlease extend the img file size before boot it. \n"
2032 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2033 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2035 if [ -e (vtimghd,1)/boot/recalbox ]; then
2036 loopback recalbox (vtimghd,1)/boot/recalbox
2037 vt_get_lib_module_ver (recalbox) /lib/modules/ vt_module_ver
2038 if [ -n "$vt_module_ver" ]; then
2039 vt_img_extra_initrd_append (recalbox)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
2046 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=recalbox
2049 set root=(vtimghd,1)
2050 configfile (vtimghd,1)/boot/grub/grub.cfg
2056 function ventoy_img_esysrescue {
2057 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2058 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2063 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=esysrescue
2066 set root=(vtimghd,1)
2067 configfile (vtimghd,1)/boot/grub/grub.cfg
2073 function ventoy_img_batocera {
2074 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2075 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2080 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=batocera
2083 set root=(vtimghd,1)
2084 syslinux_configfile (vtimghd,1)/boot/syslinux/syslinux.cfg
2090 function ventoy_img_openwrt {
2091 if [ -e (vtimghd,2)/lib64 ]; then
2092 set ventoy_busybox_ver=64
2095 vt_fs_enum_1st_dir (vtimghd,2) /lib/modules/ vt_dir_name
2097 if [ -f (vtimghd,2)/lib/modules/$vt_dir_name/dm-mod.ko ]; then
2098 set openwrt_plugin_need=0
2099 vt_img_extra_initrd_append (vtimghd,2)/lib/modules/$vt_dir_name/dm-mod.ko
2100 if [ -f (vtimghd,2)/lib/modules/$vt_dir_name/dax.ko ]; then
2101 vt_img_extra_initrd_append (vtimghd,2)/lib/modules/$vt_dir_name/dax.ko
2104 set openwrt_plugin_need=1
2105 if [ ! -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
2107 echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
2108 echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
2109 echo -en "\n$VTLANG_ENTER_EXIT ..."
2116 if vt_img_check_range "${vtoy_iso_part}${vt_chosen_path}"; then
2120 echo -e "\n IMG file need processed. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
2121 echo -e " 此 IMG 文件必须处理之后才能支持。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
2122 echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
2128 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2129 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2131 if [ $openwrt_plugin_need -eq 1 ]; then
2132 if [ -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
2133 vt_img_extra_initrd_append ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz
2138 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=openwrt
2141 set root=(vtimghd,1)
2142 configfile (vtimghd,1)/boot/grub/grub.cfg
2148 function ventoy_img_tails {
2149 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2150 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2155 vt_set_boot_opt rdinit=/vtoy/vtoy live-media=/dev/dm-1 ventoyos=tails
2158 set root=(vtimghd,1)
2159 configfile (vtimghd,1)/efi/debian/grub.cfg
2165 function ventoy_img_fydeos {
2166 if [ "$grub_platform" = "pc" ]; then
2171 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=64"
2172 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2177 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=fydeos
2180 set grubdisk=vtimghd
2181 set grubpartA=(vtimghd,3)
2182 set grubpartB=(vtimghd,5)
2183 set linuxpartA=(sda,3)
2184 set linuxpartB=(sda,5)
2186 set root=(vtimghd,12)
2187 configfile (vtimghd,12)/efi/boot/grub.cfg
2199 function ventoy_img_cloudready {
2200 if [ "$grub_platform" = "pc" ]; then
2205 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=64"
2206 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2211 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=cloudready
2214 set grubdisk=vtimghd
2215 set grubpartA=(vtimghd,3)
2216 set grubpartB=(vtimghd,5)
2217 set linuxpartA=(sda,3)
2218 set linuxpartB=(sda,5)
2220 set root=(vtimghd,12)
2221 configfile (vtimghd,12)/efi/boot/grub.cfg
2234 function ventoy_img_fwts {
2235 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2236 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2241 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=fwts
2244 configfile $prefix/distro/fwts.cfg
2250 function ventoy_img_memtest86 {
2251 chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
2255 function img_unsupport_tip {
2256 echo -e "\n This IMG file is NOT supported now. \n"
2257 echo -e " 当前不支持启动此 IMG 文件 \n"
2258 echo -en "\n$VTLANG_ENTER_EXIT ..."
2262 function legacy_img_memdisk {
2263 linux16 $vtoy_path/memdisk
2264 echo "Loading img file to memory ..."
2271 function img_common_menuentry {
2272 set ventoy_compatible=YES
2273 set ventoy_busybox_ver=32
2274 unset LoadIsoEfiDriver
2276 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
2278 if vt_check_password "${vt_chosen_path}"; then
2282 if ventoy_vcfg_proc "${vt_chosen_path}"; then
2286 if [ "$grub_platform" = "pc" ]; then
2287 if vt_check_mode 0 "$vt_chosen_name"; then
2288 legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
2293 loopback vtimghd "${vtoy_iso_part}${vt_chosen_path}"
2294 vt_img_sector "${vtoy_iso_part}${vt_chosen_path}"
2296 vt_img_part_info (vtimghd)
2298 set vtback_root=$root
2301 set vtback_theme=$theme
2304 vt_img_extra_initrd_reset
2307 vt_get_fs_label (vtimghd,1) vtImgHd1Label
2309 if [ "$vtImgHd1Label" = "STATE" ]; then
2310 vt_get_fs_label (vtimghd,3) vtImgHd3Label
2311 elif [ -d (vtimghd,2)/lib ]; then
2312 vt_get_fs_label (vtimghd,2) vtImgHd2Label
2315 if [ -z "$vtImgHd1Label" ]; then
2316 if [ -d (vtimghd,2)/efi ]; then
2317 vt_get_fs_label (vtimghd,3) vtImgHd3Label
2318 elif [ -d (vtimghd,12)/efi ]; then
2319 vt_get_fs_label (vtimghd,3) vtImgHd3Label
2323 if [ -e (vtimghd,1)/etc/hostname ]; then
2324 vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
2327 if vt_str_begin "$vtImgHd3Label" "ROOT-"; then
2328 if [ -f (vtimghd,3)/etc/os-release.d/ID ]; then
2329 vt_1st_line (vtimghd,3)/etc/os-release.d/ID vt_release_line1
2330 if vt_str_begin "$vt_release_line1" "FydeOS"; then
2333 ventoy_img_cloudready
2335 elif [ -f (vtimghd,3)/etc/cloudready-release ]; then
2336 ventoy_img_cloudready
2337 elif [ -f (vtimghd,3)/etc/chrome_dev.conf ]; then
2338 ventoy_img_cloudready
2340 elif vt_str_begin "$vtImgHd3Label" "fwts-result"; then
2342 elif vt_str_begin "$vtImgHd1Label" "LAKKA"; then
2343 ventoy_img_openelec lakka
2344 elif vt_str_begin "$vtImgHd1Label" "LIBREELEC"; then
2345 ventoy_img_openelec LibreELEC
2346 elif vt_str_begin "$vtImgHd1Label" "paldo-live"; then
2348 elif vt_str_begin "$vtImgHostname" "freedombox"; then
2349 ventoy_img_freedombox
2350 elif vt_str_begin "$vtImgHd1Label" "BATOCERA"; then
2352 elif vt_str_begin "$vtImgHd1Label" "Tails"; then
2354 elif [ "$vtImgHd2Label" = "RECALBOX" -o "$vtImgHd1Label" = "RECALBOX" ]; then
2356 elif [ "$vtImgHd1Label" = "ESYSRESCUE" ]; then
2357 ventoy_img_esysrescue
2358 elif [ -e (vtimghd,1)/easy.sfs ]; then
2360 elif [ -d (vtimghd,2)/easyos ]; then
2362 elif [ -e (vtimghd,1)/volumio.initrd ]; then
2364 elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
2366 elif [ -f (vtimghd,2)/etc/openwrt_version ]; then
2369 if [ -f (vtimghd,1)/efi/boot/mt86.png ]; then
2370 if [ "$grub_platform" = "pc" ]; then
2376 vt_linux_chain_data "${vtoy_iso_part}${vt_chosen_path}"
2377 ventoy_acpi_param ${vtoy_chain_mem_addr} 512
2378 if [ "$grub_platform" = "pc" ]; then
2379 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
2382 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi sector512 env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
2389 set root=$vtback_root
2391 set theme=$vtback_theme
2393 set ventoy_compatible=NO
2396 function img_unsupport_menuentry {
2397 common_unsupport_menuentry
2400 function mimg_common_menuentry {
2401 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
2403 if vt_check_password "${vt_chosen_path}"; then
2407 echo "memdisk mode boot for $vt_chosen_path"
2411 if [ "$grub_platform" = "pc" ]; then
2412 legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
2414 vt_load_img_memdisk "$vtoy_iso_part$vt_chosen_path" vtoy_img_buf
2416 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_img_buf_addr}:size:${vtoy_img_buf_size}
2422 #############################################################
2423 #############################################################
2424 #############################################################
2425 ####### Main Process ###########
2426 #############################################################
2427 #############################################################
2428 #############################################################
2430 set VENTOY_VERSION="1.1.05"
2432 #ACPI not compatible with Window7/8, so disable by default
2433 set VTOY_PARAM_NO_ACPI=1
2435 # Default menu display mode, you can change it as you want.
2438 set VTOY_DEFAULT_MENU_MODE=0
2440 set VTOY_MEM_DISK_STR="[Memdisk]"
2441 set VTOY_ISO_RAW_STR="Compatible Mode"
2442 set VTOY_GRUB2_MODE_STR="GRUB2 Mode"
2443 set VTOY_WIMBOOT_MODE_STR="WIMBOOT Mode"
2444 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
2446 set VTOY_F2_CMD="vt_browser_disk"
2447 set VTOY_F4_CMD="ventoy_localboot"
2448 set VTOY_F5_CMD="ventoy_diagnosis"
2449 set VTOY_F6_CMD="ventoy_ext_menu"
2450 set VTOY_HELP_CMD="ventoy_show_help"
2451 set VTOY_CHKSUM_CMD="ventoy_checksum"
2452 set VTOY_HELP_TXT_LANGUAGE="en_US"
2453 set VTOY_CHKSUM_FILE_PATH="X"
2454 set VTOY_LANG_CMD="ventoy_language"
2457 if [ "$grub_platform" = "pc" ]; then
2458 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
2460 if [ "$grub_cpu" = "i386" ]; then
2461 set VTOY_EFI_ARCH=ia32
2462 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION IA32 www.ventoy.net"
2463 elif [ "$grub_cpu" = "arm64" ]; then
2464 set VTOY_EFI_ARCH=aa64
2465 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION AA64 www.ventoy.net"
2466 elif [ "$grub_cpu" = "mips64el" ]; then
2467 set VTOY_EFI_ARCH=mips
2468 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION MIPS www.ventoy.net"
2470 set VTOY_EFI_ARCH=x64
2471 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION UEFI www.ventoy.net"
2475 vt_device $root vtoy_dev
2477 if [ "$vtoy_dev" = "tftp" ]; then
2478 set vtoy_path=($root)
2479 for vtid in 0 1 2 3; do
2480 if [ -f (hd$vtid,2)/ventoy/ventoy.cpio ]; then
2481 set vtoy_iso_part=(hd$vtid,1)
2482 set vtoy_efi_part=(hd$vtid,2)
2489 if [ -n "$vtoy_efi_part" ]; then
2490 vt_load_file_to_mem "auto" $vtoy_efi_part/grub/fonts/unicode.pf2 vtoy_font_mem
2491 loadfont mem:${vtoy_font_mem_addr}:size:${vtoy_font_mem_size}
2494 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
2495 set vt_plugin_path=$vtoy_iso_part
2497 set vt_plugin_path=$prefix
2498 vt_load_plugin $vt_plugin_path
2501 if [ "$prefix" = "(ventoydisk)/grub" ]; then
2502 set vtoy_path=(ventoydisk)/ventoy
2504 set vtoy_path=($root)/ventoy
2507 set vtoydev=$vtoy_dev
2508 set vtoy_iso_part=($vtoy_dev,1)
2509 set vtoy_efi_part=($vtoy_dev,2)
2511 vt_load_file_to_mem "auto" $prefix/fonts/unicode.pf2 vtoy_font_mem
2512 loadfont mem:${vtoy_font_mem_addr}:size:${vtoy_font_mem_size}
2514 set vt_plugin_path=$vtoy_iso_part
2517 #Load Partition Table
2518 vt_load_part_table $vtoydev
2520 #Load menu lang file
2521 ventoy_load_menu_lang_file
2524 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
2526 vt_load_plugin $vtoy_iso_part
2529 vt_check_json_path_case $vtoy_iso_part
2532 if [ -n "$VTOY_MENU_LANGUAGE" ]; then
2533 vt_init_menu_lang "$VTOY_MENU_LANGUAGE"
2535 vt_init_menu_lang en_US
2538 if [ -n "$VTOY_MENU_TIMEOUT" ]; then
2539 set timeout=$VTOY_MENU_TIMEOUT
2544 if [ -f $vtoy_iso_part/ventoy/ventoy_wimboot.img ]; then
2545 vt_load_wimboot $vtoy_iso_part/ventoy/ventoy_wimboot.img
2546 elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
2547 vt_load_wimboot $vtoy_efi_part/ventoy/ventoy_wimboot.img
2550 if [ -f $vtoy_iso_part/ventoy/ventoy_vhdboot.img ]; then
2551 vt_load_vhdboot $vtoy_iso_part/ventoy/ventoy_vhdboot.img
2552 elif [ -f $vtoy_efi_part/ventoy/ventoy_vhdboot.img ]; then
2553 vt_load_vhdboot $vtoy_efi_part/ventoy/ventoy_vhdboot.img
2557 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
2558 set VTOY_F3_CMD="vt_dynamic_menu 1 1"
2560 set VTOY_F3_CMD="vt_dynamic_menu 1 0"
2563 terminal_output console
2565 if [ -n "$vtoy_gfxmode" ]; then
2566 set gfxmode=$vtoy_gfxmode
2569 set gfxmode=1024x768
2574 if [ "$vtoy_display_mode" = "CLI" ]; then
2575 terminal_output console
2576 elif [ "$vtoy_display_mode" = "serial" ]; then
2577 if [ -n "$vtoy_serial_param" ]; then
2578 serial $vtoy_serial_param
2580 terminal_input serial
2581 terminal_output serial
2582 elif [ "$vtoy_display_mode" = "serial_console" ]; then
2583 if [ -n "$vtoy_serial_param" ]; then
2584 serial $vtoy_serial_param
2586 terminal_input serial console
2587 terminal_output serial console
2589 if [ "$vtoy_gfxmode" = "max" ]; then
2590 set gfxmode=1024x768
2591 terminal_output gfxterm
2594 vt_get_video_mode 0 vtCurMode
2595 terminal_output console
2596 set gfxmode=$vtCurMode
2597 terminal_output gfxterm
2598 elif [ "$vtoy_res_fit" = "1" ]; then
2599 terminal_output gfxterm
2602 if [ -n "$vtoy_theme" ]; then
2605 set theme=$prefix/themes/ventoy/theme.txt
2607 terminal_output gfxterm
2610 if [ "$grub_platform" = "efi" ]; then
2611 set mouse_delta=4000
2612 # terminal_input --append mouse
2615 if [ -n "$VTOY_DEFAULT_KBD_LAYOUT" ]; then
2616 set_keyboard_layout "$VTOY_DEFAULT_KBD_LAYOUT"
2619 if [ -n "$VTOY_PLUGIN_PATH_CASE_MISMATCH" ]; then
2621 echo "$VTOY_PLUGIN_PATH_CASE_MISMATCH"
2622 echo -e "\n\nPath case does not match! ventoy directory and ventoy.json MUST be all lowercase!"
2623 echo -e "\n路径大小写不匹配!ventoy 目录和 ventoy.json 文件的名字必须是全部小写,请修正!"
2624 echo -e "\n\npress ENTER to continue (请按回车键继续) ..."
2628 if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
2630 if [ -n "$VTOY_PLUGIN_ENCODE_ERROR" ]; then
2631 echo -e "\n Encoding type for ventoy.json is not supported, please convert to UTF-8.\n"
2632 echo -e " ventoy.json 文件编码格式不支持,请转换为 UTF-8 编码格式!\n"
2634 echo -e "\n Syntax error detected in ventoy.json, please check! \n"
2635 echo -e " ventoy.json 文件中有语法错误,所有配置都不会生效,请检查!\n"
2638 echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
2643 for vtTFile in ventoy.json ventoy_grub.cfg; do
2644 if [ -f $vtoy_efi_part/ventoy/$vtTFile ]; then
2646 echo -e "\n You need to put $vtTFile in the 1st partition which hold the ISO files.\n"
2647 echo -e " $vtTFile 放错分区了,请放到镜像分区里的 ventoy 目录下(此目录需要手动创建)!\n"
2648 echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
2653 #clear all input key before show main menu
2656 #export necessary variable
2664 export vtoy_iso_part
2665 export vtoy_efi_part
2666 export VENTOY_VERSION
2667 export VTOY_CUR_VIDEO_MODE
2668 export VTOY_EFI_ARCH
2669 export VTOY_MEM_DISK_STR
2670 export VTOY_ISO_RAW_STR
2671 export VTOY_GRUB2_MODE_STR
2672 export VTOY_WIMBOOT_MODE_STR
2673 export VTOY_ISO_UEFI_DRV_STR
2678 export VTOY_HELP_CMD
2679 export VTOY_CHKSUM_CMD
2680 export VTOY_HELP_TXT_LANGUAGE
2681 export VTOY_CHKSUM_FILE_PATH
2682 export VTOY_LANG_CMD
2685 #colect all image files (iso files)
2686 set ventoy_img_count=0
2687 vt_list_img $vtoy_iso_part ventoy_img_count
2690 if [ $ventoy_img_count -gt 0 ]; then
2691 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
2697 if [ -n "$VTOY_NO_ISO_TIP" ]; then
2698 NO_ISO_MENU="No ISO or supported IMG files found, $VTOY_NO_ISO_TIP"
2699 elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
2700 NO_ISO_MENU="No ISO or supported IMG files found, please check VTOY_DEFAULT_SEARCH_ROOT"
2702 NO_ISO_MENU="No ISO or supported IMG files found"
2704 menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
2705 echo -e "\n Rebooting ... "
2711 #special VTOY_DEFAULT_IMAGE process
2712 if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
2713 if regexp --set 1:vtHotkey --set 2:vtDefault "(F[2-9])>(.*)" "$VTOY_DEFAULT_IMAGE"; then
2715 set default="$vtDefault"
2716 if [ -z "$VTOY_MENU_TIMEOUT" ]; then
2719 set timeout=$VTOY_MENU_TIMEOUT
2727 if [ "$vtHotkey" = "F2" ]; then
2730 elif [ "$vtHotkey" = "F4" ]; then
2732 elif [ "$vtHotkey" = "F5" ]; then
2734 elif [ "$vtHotkey" = "F6" ]; then