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 vt_get_video_mode 0 vtCurMode
40 terminal_output console
41 set gfxmode=$vtCurMode
42 terminal_output gfxterm
45 function ventoy_cli_console {
46 if [ -z "$vtoy_display_mode" ]; then
47 terminal_output console
48 elif [ "$vtoy_display_mode" = "GUI" ]; then
49 terminal_output console
53 function ventoy_gui_console {
54 if [ -z "$vtoy_display_mode" ]; then
55 terminal_output gfxterm
56 elif [ "$vtoy_display_mode" = "GUI" ]; then
57 terminal_output gfxterm
61 function ventoy_acpi_param {
62 if [ "$VTOY_PARAM_NO_ACPI" != "1" ]; then
63 vt_acpi_param "$1" "$2"
67 function ventoy_vcfg_proc {
68 if vt_check_custom_boot "${1}" vt_vcfg; then
69 set vtoy_chosen_path="${1}"
70 vt_file_basefile "${vtoy_chosen_path}" vtoy_chosen_file
72 export vtoy_chosen_path
73 export vtoy_chosen_file
75 configfile "${vtoy_iso_part}${vt_vcfg}"
82 function ventoy_language {
83 configfile $prefix/menulang.cfg
86 function ventoy_diagnosis {
88 configfile $prefix/debug.cfg
91 function ventoy_localboot {
92 configfile $prefix/localboot.cfg
95 function ventoy_ext_menu {
96 if [ -e $vt_plugin_path/ventoy/ventoy_grub.cfg ]; then
97 set ventoy_new_context=1
98 configfile $vt_plugin_path/ventoy/ventoy_grub.cfg
99 unset ventoy_new_context
101 echo "ventoy_grub.cfg NOT exist."
102 echo -en "\n$VTLANG_ENTER_EXIT ..."
107 function ventoy_checksum {
108 if [ -f "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" ]; then
109 configfile $prefix/checksum.cfg
113 function ventoy_show_help {
114 if [ -f $prefix/help.tar.gz ]; then
115 if [ -z "$vtoy_help_txt_mem_addr" ]; then
116 vt_load_file_to_mem "auto" $prefix/help.tar.gz vtoy_help_txt_mem
119 loopback vt_help_tarfs mem:${vtoy_help_txt_mem_addr}:size:${vtoy_help_txt_mem_size}
120 vt_cur_menu_lang vtCurLang
121 if [ -f "(vt_help_tarfs)/help/${vtCurLang}.txt" ]; then
122 cat "(vt_help_tarfs)/help/${vtCurLang}.txt"
124 cat "(vt_help_tarfs)/help/en_US.txt"
126 loopback -d vt_help_tarfs
130 function ventoy_load_menu_lang_file {
131 vt_load_file_to_mem "auto" $prefix/menu.tar.gz vtoy_menu_lang_mem
132 loopback vt_menu_tarfs mem:${vtoy_menu_lang_mem_addr}:size:${vtoy_menu_lang_mem_size}
135 function get_os_type {
139 if vt_str_begin "$vt_volume_id" "DLC Boot"; then
140 if [ -f (loop)/DLCBoot.exe ]; then
144 for file in "efi/microsoft/boot/bcd" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com" ; do
145 if vt_file_exist_nocase (loop)/$file; then
152 if [ "$vtoy_os" = "Linux" ]; then
153 if vt_strstr "$vt_system_id" "FreeBSD"; then
155 set vt_unix_type=FreeBSD
156 elif [ -e (loop)/bin/freebsd-version ]; then
158 set vt_unix_type=FreeBSD
159 elif [ -e (loop)/boot/kernel/geom_ventoy.ko ]; then
161 set vt_unix_type=FreeBSD
162 elif vt_str_begin "$vt_system_id" "DragonFly"; then
164 set vt_unix_type=DragonFly
167 elif [ -e (loop)/boot/kernel/kernel ]; then
168 if file --is-x86-kfreebsd (loop)/boot/kernel/kernel; then
170 set vt_unix_type=FreeBSD
171 elif file --is-x86-knetbsd (loop)/boot/kernel/kernel; then
173 set vt_unix_type=NetBSD
178 if [ -n "${vtdebug_flag}" ]; then
179 echo ISO is "$vtoy_os"
183 function vt_check_compatible_pe {
184 #Check for PE without external tools
185 #set compatible if ISO file is less than 80MB
186 if [ $vt_chosen_size -GT 33554432 -a $vt_chosen_size -LE 83886080 ]; then
187 set ventoy_compatible=YES
193 function vt_check_compatible_linux {
194 if vt_str_begin "$vt_volume_id" "embootkit"; then
195 set ventoy_compatible=YES
196 elif [ -e "$1/casper/tinycore.gz" ]; then
197 set ventoy_compatible=YES
203 function locate_initrd {
204 vt_linux_locate_initrd
206 if [ -n "${vtdebug_flag}" ]; then
212 function locate_wim {
213 vt_windows_locate_wim_patch (loop) "$1"
215 if [ -n "${vtdebug_flag}" ]; then
216 echo '###############################################'
218 echo '###############################################'
223 function distro_specify_wim_patch {
224 if [ -d (loop)/h3pe ]; then
225 vt_windows_collect_wim_patch wim /BOOT/H3_10PE.WIM
226 vt_windows_collect_wim_patch wim /BOOT/H3_7PE.WIM
227 vt_windows_collect_wim_patch wim /BOOT/H3_8PE.WIM
228 vt_windows_collect_wim_patch wim /BOOT/H3_81PE.WIM
229 elif [ -d (loop)/2k10/winpe ]; then
230 vt_windows_collect_wim_patch wim /2k10/winpe/w1086pe.wim
231 vt_windows_collect_wim_patch wim /2k10/winpe/w8x86pe.wim
232 vt_windows_collect_wim_patch wim /2k10/winpe/w7x86pe.wim
236 function distro_specify_wim_patch_phase2 {
237 if [ -f (loop)/boot/boot.wim ]; then
238 vt_windows_collect_wim_patch wim /boot/boot.wim
239 elif [ -f (loop)/sources/boot.wim ]; then
240 vt_windows_collect_wim_patch wim /sources/boot.wim
243 if vt_str_begin "$vt_volume_id" "DLC Boot"; then
244 for vwfile in "/DLC1/WinPE/W11x64.wim" "/DLC1/WinPE/W10x64.wim" "/DLC1/WinPE/W10x86.wim"; do
245 if [ -f (loop)/$vwfile ]; then
246 vt_windows_collect_wim_patch wim $vwfile
254 function distro_specify_initrd_file {
255 if [ -e (loop)/boot/all.rdz ]; then
256 vt_linux_specify_initrd_file /boot/all.rdz
257 elif [ -e (loop)/boot/xen.gz ]; then
258 if [ -e (loop)/install.img ]; then
259 vt_linux_specify_initrd_file /install.img
261 elif [ -d (loop)/casper ]; then
262 if [ -e (loop)/casper/initrd ]; then
263 vt_linux_specify_initrd_file /casper/initrd
265 if [ -e (loop)/casper/initrd.gz ]; then
266 vt_linux_specify_initrd_file /casper/initrd.gz
268 if [ -e (loop)/casper/initrd-oem ]; then
269 vt_linux_specify_initrd_file /casper/initrd-oem
271 elif [ -e (loop)/boot/grub/initrd.xz ]; then
272 vt_linux_specify_initrd_file /boot/grub/initrd.xz
273 elif [ -e (loop)/initrd.gz ]; then
274 vt_linux_specify_initrd_file /initrd.gz
275 elif [ -e (loop)/slax/boot/initrfs.img ]; then
276 vt_linux_specify_initrd_file /slax/boot/initrfs.img
277 elif [ -e (loop)/minios/boot/initrfs.img ]; then
278 vt_linux_specify_initrd_file /minios/boot/initrfs.img
279 elif [ -e (loop)/pmagic/initrd.img ]; then
280 vt_linux_specify_initrd_file /pmagic/initrd.img
281 elif [ -e (loop)/boot/initrd.xz ]; then
282 vt_linux_specify_initrd_file /boot/initrd.xz
283 elif [ -e (loop)/boot/initrd.gz ]; then
284 vt_linux_specify_initrd_file /boot/initrd.gz
285 elif [ -f (loop)/boot/initrd ]; then
286 vt_linux_specify_initrd_file /boot/initrd
287 elif [ -f (loop)/boot/x86_64/loader/initrd ]; then
288 vt_linux_specify_initrd_file /boot/x86_64/loader/initrd
289 elif [ -f (loop)/boot/initramfs-x86_64.img ]; then
290 vt_linux_specify_initrd_file /boot/initramfs-x86_64.img
291 elif [ -f (loop)/boot/isolinux/initramfs_data64.cpio.gz ]; then
292 vt_linux_specify_initrd_file /boot/isolinux/initramfs_data64.cpio.gz
293 elif [ -f (loop)/boot/initrd.img ]; then
294 vt_linux_specify_initrd_file /boot/initrd.img
298 if [ -f (loop)/isolinux/initrd.gz ]; then
299 vt_linux_specify_initrd_file /isolinux/initrd.gz
302 if vt_str_begin "$vt_volume_id" "QUBES"; then
303 vt_linux_specify_initrd_file /images/pxeboot/initrd.img
306 if [ "$vt_chosen_size" = "1133375488" ]; then
307 if [ -d (loop)/boot/grub/x86_64-efi ]; then
308 vt_cpio_busybox64 "64h"
314 function distro_specify_initrd_file_phase2 {
315 if [ -f (loop)/boot/initrd.img ]; then
316 vt_linux_specify_initrd_file /boot/initrd.img
317 elif [ -f (loop)/Setup/initrd.gz ]; then
318 vt_linux_specify_initrd_file /Setup/initrd.gz
319 elif [ -f (loop)/isolinux/initramfs ]; then
320 vt_linux_specify_initrd_file /isolinux/initramfs
321 elif [ -f (loop)/boot/iniramfs.igz ]; then
322 vt_linux_specify_initrd_file /boot/iniramfs.igz
323 elif [ -f (loop)/initrd-x86_64 ]; then
324 vt_linux_specify_initrd_file /initrd-x86_64
325 elif [ -f (loop)/live/initrd.img ]; then
326 vt_linux_specify_initrd_file /live/initrd.img
327 elif [ -f (loop)/initrd.img ]; then
328 vt_linux_specify_initrd_file /initrd.img
329 elif [ -f (loop)/sysresccd/boot/x86_64/sysresccd.img ]; then
330 vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
331 elif [ -f (loop)/CDlinux/initrd ]; then
332 vt_linux_specify_initrd_file /CDlinux/initrd
333 elif [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
334 vt_linux_specify_initrd_file /parabola/boot/x86_64/parabolaiso.img
335 if [ -f (loop)/parabola/boot/i686/parabolaiso.img ]; then
336 vt_linux_specify_initrd_file /parabola/boot/i686/parabolaiso.img
338 elif [ -f (loop)/parabola/boot/x86_64/initramfs-linux-libre.img ]; then
339 vt_linux_specify_initrd_file /parabola/boot/x86_64/initramfs-linux-libre.img
340 if [ -f (loop)/parabola/boot/i686/initramfs-linux-libre.img ]; then
341 vt_linux_specify_initrd_file /parabola/boot/i686/initramfs-linux-libre.img
343 elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
344 vt_linux_specify_initrd_file /hyperbola/boot/x86_64/hyperiso.img
345 if [ -f (loop)/hyperbola/boot/i686/hyperiso.img ]; then
346 vt_linux_specify_initrd_file /hyperbola/boot/i686/hyperiso.img
348 elif [ -f (loop)/EFI/BOOT/initrd.img ]; then
350 vt_linux_specify_initrd_file /EFI/BOOT/initrd.img
351 if [ "$grub_platform" != "pc" ]; then
352 vt_add_replace_file 0 "initrd.img"
354 elif [ -f (loop)/initrd ]; then
355 vt_linux_specify_initrd_file /initrd
356 elif [ -f (loop)/live/initrd1 ]; then
357 vt_linux_specify_initrd_file /live/initrd1
358 elif [ -f (loop)/isolinux/initrd.img ]; then
359 vt_linux_specify_initrd_file /isolinux/initrd.img
360 elif [ -f (loop)/isolinux/initrd.gz ]; then
361 vt_linux_specify_initrd_file /isolinux/initrd.gz
362 elif [ -f (loop)/syslinux/kernel/initramfs.gz ]; then
363 vt_linux_specify_initrd_file /syslinux/kernel/initramfs.gz
364 elif vt_strstr "$vt_volume_id" "Daphile"; then
365 vt_linux_parse_initrd_isolinux (loop)/isolinux/
366 elif [ -f (loop)/boot/rootfs.xz ]; then
367 vt_linux_specify_initrd_file /boot/rootfs.xz
368 if [ "$grub_platform" != "pc" ]; then
369 vt_add_replace_file 0 "minimal\\x86_64\\rootfs.xz"
371 elif [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
372 vt_linux_specify_initrd_file /arch/boot/x86_64/archiso.img
373 if [ "$grub_platform" != "pc" ]; then
374 vt_add_replace_file 0 "EFI\\archiso\\archiso.img"
376 elif [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
377 vt_linux_specify_initrd_file /blackarch/boot/x86_64/archiso.img
378 elif [ -f (loop)/blackarch/boot/x86_64/initramfs-linux.img ]; then
379 vt_linux_specify_initrd_file /blackarch/boot/x86_64/initramfs-linux.img
381 elif [ -f (loop)/install.amd/initrd.gz ]; then
382 vt_linux_specify_initrd_file /live/initrd2.img
383 vt_linux_specify_initrd_file /install.amd/initrd.gz
384 vt_linux_specify_initrd_file /install.amd/gtk/initrd.gz
385 elif [ -f (loop)/boot/grub/kernels.cfg ]; then
386 vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
387 elif [ -f (loop)/austrumi/initrd.gz ]; then
388 vt_linux_specify_initrd_file /austrumi/initrd.gz
389 if [ -f (loop)/EFI/BOOT/bootx64.efi ]; then
390 vt_cpio_busybox64 "64h"
392 elif [ -f (loop)/boot/initfs.x86_64-efi ]; then
393 vt_linux_specify_initrd_file /boot/initfs.x86_64-efi
394 if [ -f (loop)/boot/initfs.i386-pc ]; then
395 vt_linux_specify_initrd_file /boot/initfs.i386-pc
397 elif [ -f (loop)/antiX/initrd.gz ]; then
398 vt_linux_specify_initrd_file /antiX/initrd.gz
399 elif [ -f (loop)/360Disk/initrd.gz ]; then
400 vt_linux_specify_initrd_file /360Disk/initrd.gz
401 elif [ -f (loop)/porteus/initrd.xz ]; then
402 vt_linux_specify_initrd_file /porteus/initrd.xz
403 elif [ -f (loop)/pyabr/boot/initrfs.img ]; then
404 vt_linux_specify_initrd_file /pyabr/boot/initrfs.img
405 elif [ -f (loop)/initrd0.img ]; then
406 vt_linux_specify_initrd_file /initrd0.img
407 elif [ -f (loop)/sysresccd/boot/i686/sysresccd.img ]; then
408 vt_linux_specify_initrd_file /sysresccd/boot/i686/sysresccd.img
409 elif [ -f (loop)/boot/full.cz ]; then
410 vt_linux_specify_initrd_file /boot/full.cz
411 elif [ -f (loop)/images/pxeboot/initrd.img ]; then
412 vt_linux_specify_initrd_file /images/pxeboot/initrd.img
413 elif [ -f (loop)/live/initrd ]; then
414 vt_linux_specify_initrd_file /live/initrd
415 elif [ -f (loop)/initramfs-linux.img ]; then
416 vt_linux_specify_initrd_file /initramfs-linux.img
417 elif [ -f (loop)/boot/isolinux/initrd.gz ]; then
418 vt_linux_specify_initrd_file /boot/isolinux/initrd.gz
423 function ventoy_get_ghostbsd_ver {
424 # fallback to parse version from elf /boot/kernel/kernel
425 set vt_freebsd_ver=xx
428 function ventoy_get_furybsd_ver {
429 set vt_freebsd_ver=12.x
430 if regexp --set 1:vtFuryVer "(14|13)\.[0-9]" "$2"; then
431 set vt_freebsd_ver=${vtFuryVer}.x
435 function ventoy_get_freenas_ver {
436 set vt_freebsd_ver=11.x
438 if [ -e (loop)/FreeNAS-MANIFEST ]; then
439 vt_parse_freenas_ver (loop)/FreeNAS-MANIFEST vt_freenas_ver
440 if regexp --set 1:vtNasVer "^(14|13|12|11)\.[0-9]" "$vt_freenas_ver"; then
441 set vt_freebsd_ver=${vtNasVer}.x
446 function ventoy_get_truenas_ver {
447 set vt_freebsd_ver=12.x
449 if [ -e (loop)/TrueNAS-MANIFEST ]; then
450 vt_parse_freenas_ver (loop)/TrueNAS-MANIFEST vt_truenas_ver
451 if regexp --set 1:vtTNasVer "^(14|13|12|11)\.[0-9]" "$vt_truenas_ver"; then
452 set vt_freebsd_ver=${vtTNasVer}.x
457 function ventoy_get_midnightbsd_ver {
458 if vt_str_begin "$vt_volume_id" "1_"; then
459 set vt_freebsd_ver=11.x
460 elif vt_str_begin "$vt_volume_id" "2_"; then
461 set vt_freebsd_ver=2.x
462 elif vt_str_begin "$vt_volume_id" "3_"; then
463 set vt_freebsd_ver=3.x
467 function ventoy_freebsd_proc {
468 set vtFreeBsdDistro=FreeBSD
469 set vt_freebsd_ver=xx
471 if [ -e (loop)/boot/kernel/geom_ventoy.ko ]; then
472 vt_unix_ko_fillmap /boot/kernel/geom_ventoy.ko
476 if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
477 ventoy_get_ghostbsd_ver "$1" "${chosen_path}"
478 elif vt_strstr "$vt_volume_id" "FREENAS"; then
479 ventoy_get_freenas_ver "$1" "${chosen_path}"
480 elif vt_strstr "$vt_volume_id" "TRUENAS"; then
481 ventoy_get_truenas_ver "$1" "${chosen_path}"
482 elif vt_strstr "$vt_volume_id" "FURYBSD"; then
483 ventoy_get_furybsd_ver "$1" "${chosen_path}"
484 elif regexp --set 1:vtBsdVerNum "^(14|13|12|11|10|9)_[0-9]" "$vt_volume_id"; then
485 set vt_freebsd_ver=${vtBsdVerNum}.x
486 elif [ -d (loop)/usr/midnightbsd-dist ]; then
487 ventoy_get_midnightbsd_ver "$1" "${chosen_path}"
488 set vtFreeBsdDistro=MidnightBSD
489 elif [ -e (loop)/bin/freebsd-version ]; then
490 vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
491 if regexp --set 1:vtBsdVerNum "\"(14|13|12|11|10|9)\.[0-9]-" "$vt_userland_ver"; then
492 set vt_freebsd_ver=${vtBsdVerNum}.x
494 elif [ -e (loop)/README.TXT ]; then
495 vt_1st_line (loop)/README.TXT vt_freebsd_line1
496 if regexp --set 1:vtBsdVerNum "FreeBSD (14|13|12|11|10|9)\.[0-9]-" "$vt_freebsd_line1"; then
497 set vt_freebsd_ver=${vtBsdVerNum}.x
499 elif vt_strstr "${chosen_path}" "MidnightBSD"; then
500 set vt_freebsd_ver=9.x
504 if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
505 set vtFreeBsdDistro=ClonOS
508 set vt_freebsd_bit=64
509 for file in "/boot/kernel/kernel" "/boot/kernel/kernel.gz"; do
510 if [ -e (loop)/$file ]; then
511 if file --is-i386-kfreebsd (loop)/$file; then
512 set vt_freebsd_bit=32
518 if [ "$vt_freebsd_ver" = "xx" ]; then
519 if [ -e (loop)/boot/kernel/kernel ]; then
520 vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel $vt_freebsd_bit vt_freebsd_ver
521 elif [ -e (loop)/boot/kernel/kernel.gz ]; then
522 vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel.gz $vt_freebsd_bit vt_freebsd_ver
525 if [ "$vt_freebsd_ver" = "xx" ]; then
526 set vt_freebsd_ver=14.x
530 if [ "$vt_freebsd_ver" = "14.x" ]; then
531 if [ -e (loop)/boot/lua/brand-pfSense.lua ]; then
532 set vtFreeBsdDistro=pfSense
537 if [ -n "${vtdebug_flag}" ]; then
538 echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
541 unset vt_unix_mod_path
542 for file in "/COPYRIGHT" "/FreeNAS-MANIFEST" "/TrueNAS-MANIFEST" "/version" "/etc/fstab"; do
543 if [ -e (loop)${file} ]; then
544 set vt_unix_mod_path=${file}
549 if [ -n "$vt_unix_mod_path" ]; then
550 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
551 vt_unix_replace_conf FreeBSD "${1}${chosen_path}"
552 elif [ -e (loop)/easyre.ufs.uzip ]; then
553 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
554 if [ "$grub_platform" = "pc" ]; then
555 vt_unix_replace_grub_conf "/boot/grub/i386-pc/linux.mod" "cd9"
557 vt_unix_replace_conf FreeBSD "${1}${chosen_path}" "cd9"
562 function ventoy_dragonfly_proc {
564 unset vt_unix_mod_path
565 for file in "/boot/kernel/initrd.img.gz"; do
566 if [ -e (loop)${file} ]; then
567 set vt_unix_mod_path=${file}
572 vt_unix_replace_ko $vt_unix_mod_path ${vtoy_path}/dragonfly.mfs.xz
573 vt_unix_fill_image_desc
575 vt_unix_replace_conf DragonFly "${1}${chosen_path}"
578 function ventoy_unix_comm_proc {
581 vt_unix_check_vlnk "${1}${chosen_path}"
583 if [ "$ventoy_compatible" = "NO" ]; then
584 loopback vtunix $vtoy_efi_part/ventoy/ventoy_unix.cpio
586 if [ "$vt_unix_type" = "FreeBSD" ]; then
587 ventoy_freebsd_proc "$1" "${chosen_path}"
588 elif [ "$vt_unix_type" = "DragonFly" ]; then
589 ventoy_dragonfly_proc "$1" "${chosen_path}"
590 elif [ "$vt_unix_type" = "NetBSD" ]; then
591 echo "NetBSD not supported"
595 if [ -n "${vtdebug_flag}" ]; then
596 echo "Unknown unix type"
601 vt_unix_chain_data "${1}${chosen_path}"
606 function uefi_windows_menu_func {
609 unset vt_cur_wimboot_mode
610 if vt_check_mode 4 "$vt_chosen_name"; then
611 set vt_cur_wimboot_mode=1
614 if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
615 if [ "$ventoy_fs_probe" = "iso9660" ]; then
617 vt_iso9660_nojoliet 1
621 for file in "efi/microsoft/boot/bcd"; do
622 vt_windows_collect_wim_patch bcd (loop)/$file
625 vt_windows_count_wim_patch vt_wim_cnt
626 if [ $vt_wim_cnt -eq 0 ]; then
627 distro_specify_wim_patch_phase2
631 locate_wim "${chosen_path}"
634 vt_windows_chain_data "${1}${chosen_path}"
637 if [ "$vt_cur_wimboot_mode" = "1" ]; then
641 if [ -n "$vtoy_chain_mem_addr" ]; then
642 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
643 ventoy_max_resolution
644 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}
647 echo "chain empty failed"
652 function uefi_find_replace_initrd {
653 if vt_get_efi_vdisk_offset "${1}${2}" vt_efivdisk_offset; then
654 loopback -s $vt_efivdisk_offset vtefivdisk "${1}${2}"
657 vt_search_replace_initrd (vtefivdisk) vt_rp_initrd
659 if [ -n "$vt_rp_initrd" ]; then
660 vt_add_replace_file $3 "$vt_rp_initrd"
663 loopback -d vtefivdisk
668 function uefi_linux_menu_func {
670 if [ "$ventoy_compatible" = "NO" ]; then
672 if [ "$ventoy_fs_probe" = "udf" ]; then
674 set ventoy_fs_probe=iso9660
678 vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"
680 vt_linux_clear_initrd
682 if [ -d (loop)/pmagic ]; then
683 vt_linux_specify_initrd_file /pmagic/initrd.img
685 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
686 if [ -e (loop)/$file ]; then
687 vt_linux_parse_initrd_grub file (loop)/$file
692 # special process for special distros
693 if [ -d (loop)/loader/entries ]; then
694 vt_linux_parse_initrd_grub dir (loop)/loader/entries/
695 elif [ -d (loop)/boot/grub ]; then
696 vt_linux_parse_initrd_grub dir (loop)/boot/grub/
699 distro_specify_initrd_file
701 vt_linux_initrd_count vtcount
703 if [ $vtcount -eq 0 ]; then
704 if [ -e (loop)/EFI/boot/livegrub.cfg ]; then
705 vt_linux_parse_initrd_grub file (loop)/EFI/boot/livegrub.cfg
707 distro_specify_initrd_file_phase2
709 if [ "$vt_efi_dir" = "NO" ]; then
710 if [ -f (loop)/efi.img ]; then
711 vt_add_replace_file 0 "initrd"
718 if [ -d (loop)/loader/entries ]; then
719 vt_linux_get_main_initrd_index vtindex
721 if [ -d (loop)/arch ]; then
722 if [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
723 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
724 elif [ -f (loop)/arch/boot/x86_64/initramfs-linux.img ]; then
725 vt_add_replace_file $vtindex "arch\\boot\\x86_64\\initramfs-linux.img"
726 elif [ -f (loop)/boot/initramfs_x86_64.img ]; then
727 vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img"
729 elif [ -d (loop)/blackarch ]; then
730 if [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
731 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
732 elif [ -f (loop)/blackarch/boot/x86_64/initramfs-linux.img ]; then
733 vt_add_replace_file $vtindex "blackarch\\boot\\x86_64\\initramfs-linux.img"
735 elif [ -d (loop)/anarchy ]; then
736 if [ -f (loop)/anarchy/boot/x86_64/initramfs-linux.img ]; then
737 vt_add_replace_file $vtindex "anarchy\\boot\\x86_64\\initramfs-linux.img"
739 elif [ -d (loop)/parabola ]; then
740 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
741 vt_add_replace_file $vtindex "EFI\\parabolaiso\\parabolaiso.img"
742 elif [ -f (loop)/parabola/boot/x86_64/initramfs-linux-libre.img ]; then
743 vt_add_replace_file $vtindex "parabola\\boot\\x86_64\\initramfs-linux-libre.img"
745 elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
746 vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
747 elif [ -f (loop)/loader/entries/thinstation.conf ]; then
748 vt_add_replace_file $vtindex "boot\\initrd"
749 elif [ -f (loop)/loader/entries/pisi-efi-x86_64.conf ]; then
750 vt_add_replace_file $vtindex "EFI\\pisi\\initrd.img"
753 vt_get_replace_file_cnt vt_replace_cnt
754 if [ $vt_replace_cnt -eq 0 ]; then
755 uefi_find_replace_initrd "$1" "$2" $vtindex
757 elif [ -d (loop)/EFI/boot/entries ]; then
758 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
759 vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
760 elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
761 vt_add_replace_file 0 "EFI\\hyperiso\\hyperiso.img"
763 elif [ -d (loop)/EFI/BOOT/entries ]; then
764 vt_linux_get_main_initrd_index vtindex
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)/parabola/boot/x86_64/initramfs-linux-libre.img ]; then
769 vt_add_replace_file $vtindex "parabola\\boot\\x86_64\\initramfs-linux-libre.img"
771 elif [ -e (loop)/syslinux/alt0/full.cz ]; then
772 vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
773 set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
775 elif vt_str_begin "$vt_volume_id" "SolusLive"; then
776 vt_add_replace_file 0 "initrd"
782 vt_linux_chain_data "${1}${chosen_path}"
784 if [ -n "$LoadIsoEfiDriver" -a $vt_chosen_size -LT 104857600 ]; then
785 if [ -f (loop)/efi/clover/cloverx64.efi ]; then
786 unset LoadIsoEfiDriver
790 if [ -n "$vtoy_chain_mem_addr" ]; then
791 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
795 if vt_check_mode 3 "$vt_chosen_name"; then
797 elif vt_str_begin "$vt_volume_id" "HOLO_"; then
798 if [ -d (loop)/loader/entries ]; then
801 elif vt_str_begin "$vt_volume_id" "KRD"; then
802 if [ -f (loop)/boot/grub/grub.cfg.sig ]; then
807 if [ -n "$vtGrub2Mode" ]; then
810 if [ "$VTOY_EFI_ARCH" != "mips" ]; then
811 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}
817 set vtback_root=$root
819 set vtback_theme=$theme
822 vt_trailer_cpio "$vtoy_iso_part" "$vt_chosen_path" noinit
823 vt_set_boot_opt rdinit=/vtoy/vtoy
826 set vtback_cfg_find=0
827 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
828 if [ -e "$cfg" ]; then
829 set vtback_cfg_find=1
834 if [ $vtback_cfg_find -eq 0 ]; then
835 if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then
836 if vt_str_begin "$vt_volume_id" "HOLO_"; then
838 vt_systemd_menu (loop,2) vt_sys_menu_mem
840 vt_systemd_menu (loop) vt_sys_menu_mem
842 set vtback_cfg_find=1
843 configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
847 if [ $vtback_cfg_find -eq 0 ]; then
848 if [ -f (loop)/boot/isolinux/syslnx64.cfg ]; then
849 syslinux_configfile (loop)/boot/isolinux/syslnx64.cfg
850 set vtback_cfg_find=1
851 elif [ -f (loop)/boot/syslinux/porteus.cfg ]; then
852 syslinux_configfile (loop)/boot/syslinux/porteus.cfg
853 set vtback_cfg_find=1
857 if [ "$vtback_cfg_find" = "0" ]; then
859 echo "No bootfile found for UEFI!"
860 echo "Maybe the image does not support $VTOY_EFI_ARCH UEFI"
866 set root=$vtback_root
867 set theme=$vtback_theme
871 echo "chain empty failed"
876 function uefi_unix_menu_func {
877 ventoy_unix_comm_proc $1 "${chosen_path}"
879 if [ -n "$vtoy_chain_mem_addr" ]; then
880 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
882 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}
885 echo "chain empty failed"
890 function ventoy_reset_nojoliet {
891 if vt_str_begin "$vt_volume_id" "ARCARESCUE"; then
892 vt_iso9660_nojoliet 1
894 vt_iso9660_nojoliet 0
897 vt_append_extra_sector 0
900 function uefi_iso_menu_func {
901 if [ -n "$vtisouefi" ]; then
902 set LoadIsoEfiDriver=on
904 elif vt_check_mode 2 "$vt_chosen_name"; then
905 set LoadIsoEfiDriver=on
907 unset LoadIsoEfiDriver
911 vt_select_auto_install "${chosen_path}"
912 vt_select_persistence "${chosen_path}"
914 if ! vt_is_udf "${1}${chosen_path}"; then
915 # Lenovo EasyStartup need an addional sector for boundary check
916 if vt_str_begin "$vt_volume_id" "EasyStartup"; then
917 vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
918 vt_append_extra_sector 1
922 if [ -d (loop)/EFI ]; then
924 elif [ -d (loop)/efi ]; then
930 if [ -n "$vtcompat" ]; then
931 set ventoy_compatible=YES
933 elif vt_check_mode 1 "$vt_chosen_name"; then
934 set ventoy_compatible=YES
936 vt_check_compatible (loop)
939 vt_img_sector "${1}${chosen_path}"
941 if [ "$ventoy_fs_probe" = "iso9660" ]; then
942 vt_select_conf_replace "${1}" "${chosen_path}"
945 if [ "$vtoy_os" = "Windows" ]; then
946 vt_check_compatible_pe (loop)
947 uefi_windows_menu_func "$1" "${chosen_path}"
948 elif [ "$vtoy_os" = "Unix" ]; then
949 uefi_unix_menu_func "$1" "${chosen_path}"
951 vt_check_compatible_linux (loop)
952 uefi_linux_menu_func "$1" "${chosen_path}"
958 function uefi_iso_memdisk {
959 echo 'Loading ISO file to memory ...'
960 vt_load_img_memdisk "${1}${2}" vtoy_iso_buf
963 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}
969 function vtoy_windows_wimboot {
970 if [ -f (loop)/x86/sources/boot.wim -a -f (loop)/x64/sources/boot.wim ]; then
971 vt_sel_wimboot vtoy_wimboot_bit
972 if [ "$vtoy_wimboot_bit" = "32" ]; then
973 set vtoy_wimboot_prefix=(loop)/x86
975 set vtoy_wimboot_prefix=(loop)/x64
978 set vtoy_wimboot_prefix=(loop)
979 if vt_is_pe64 $vtoy_wimboot_prefix/setup.exe; then
980 set vtoy_wimboot_bit=64
982 set vtoy_wimboot_bit=32
986 if [ -n "${vtdebug_flag}" ]; then
987 echo vtoy_wimboot_prefix=$vtoy_wimboot_prefix vtoy_wimboot_bit=$vtoy_wimboot_bit vt_wimkernel=$vt_wimkernel
990 vt_windows_wimboot_data "$vtoy_wimboot_prefix/sources/boot.wim" vtoy_init_exe vtoy_wim_bit
992 if [ "$grub_platform" = "pc" ]; then
993 linux16 "$vtoy_path/$vt_wimkernel" quiet
996 vt_set_wim_load_prompt 1 "Loading files......"
997 initrd16 newc:winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
998 newc:vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd \
999 newc:bcd:$vtoy_wimboot_prefix/boot/bcd \
1000 newc:boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi \
1001 newc:boot.wim:$vtoy_wimboot_prefix/sources/boot.wim
1002 vt_set_wim_load_prompt 0
1005 vt_set_wim_load_prompt 1 "Loading files......"
1006 vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/sources/boot.wim vtoy_wimfile_mem
1007 vt_set_wim_load_prompt 0
1009 if [ $? -eq 0 ]; then
1010 set vtoy_wimfile_path=mem:${vtoy_wimfile_mem_addr}:size:${vtoy_wimfile_mem_size}
1012 set vtoy_wimfile_path=$vtoy_wimboot_prefix/sources/boot.wim
1016 chainloader "$vtoy_path/$vt_wimkernel" quiet \
1017 "vf=winpeshl.exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
1018 "vf=vtoy_wimboot:$vtoy_wimboot_prefix/boot/bcd" \
1019 "vf=bcd:$vtoy_wimboot_prefix/boot/bcd" \
1020 "vf=boot.sdi:$vtoy_wimboot_prefix/boot/boot.sdi" \
1021 "vf=boot.wim:$vtoy_wimfile_path" \
1022 pfsize=$vtoy_chain_file_size \
1023 pfread=$vtoy_chain_file_read
1029 function vtoy_winpe_wimboot {
1030 unset vtoy_boot_sdi_legacy
1031 unset vtoy_boot_sdi_efi
1033 set vtoy_wimboot_prefix=(loop)
1034 set vtoy_wim_path="$1"
1036 if [ -n "${vtdebug_flag}" ]; then
1037 echo "winpe_wimboot $1 $2 $3"
1040 if [ "$2" != "0" ]; then
1041 set vtoy_boot_sdi_legacy="newc:boot.sdi:$vtoy_wimboot_prefix/$2"
1042 set vtoy_boot_sdi_efi="vf=boot.sdi:$vtoy_wimboot_prefix/$2"
1045 vt_windows_wimboot_data $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_init_exe vtoy_wim_bit
1047 if [ "$grub_platform" = "pc" ]; then
1048 linux16 "$vtoy_path/$vt_wimkernel" quiet
1051 vt_set_wim_load_prompt 1 "Loading files......"
1052 initrd16 newc:$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size} \
1053 newc:vtoy_wimboot:$vtoy_path/$vt_wimkernel \
1054 newc:bootmgr.exe:mem:${vtoy_pe_bootmgr_mem_addr}:size:${vtoy_pe_bootmgr_mem_size} \
1055 newc:bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size} \
1056 $vtoy_boot_sdi_legacy \
1057 newc:boot.wim:$vtoy_wimboot_prefix/$vtoy_wim_path
1058 vt_set_wim_load_prompt 0
1061 if [ "$VTOY_EFI_ARCH" = "x64" -a "$vtoy_wim_bit" = "32" ]; then
1062 echo -e "\nThis is 32bit Windows and does NOT support x86_64 UEFI firmware.\n"
1063 echo -e "这是32位的 Windows 系统,不支持当前的64位 UEFI 环境。\n"
1066 vt_set_wim_load_prompt 1 "Loading files......"
1067 vt_load_file_to_mem "nodecompress" $vtoy_wimboot_prefix/$vtoy_wim_path vtoy_wimfile_mem
1068 vt_set_wim_load_prompt 0
1070 if [ $? -eq 0 ]; then
1071 set vtoy_wimfile_path=mem:${vtoy_wimfile_mem_addr}:size:${vtoy_wimfile_mem_size}
1073 set vtoy_wimfile_path=$vtoy_wimboot_prefix/$vtoy_wim_path
1076 unset vtoy_boot_efi_path
1077 if [ -F (loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi ]; then
1078 set vtoy_boot_efi_path="vf=bootx64.efi:(loop)/efi/boot/boot${VTOY_EFI_ARCH}.efi"
1082 chainloader "$vtoy_path/$vt_wimkernel" quiet \
1083 "vf=$vtoy_init_exe:mem:${vtoy_wimboot_mem_addr}:size:${vtoy_wimboot_mem_size}" \
1084 "vf=vtoy_wimboot:$vtoy_path/$vt_wimkernel" \
1085 "vf=bcd:mem:${vtoy_pe_bcd_mem_addr}:size:${vtoy_pe_bcd_mem_size}" \
1086 "$vtoy_boot_sdi_efi" \
1087 "$vtoy_boot_efi_path" \
1088 "vf=boot.wim:$vtoy_wimfile_path" \
1089 pfsize=$vtoy_chain_file_size \
1090 pfread=$vtoy_chain_file_read
1096 function vtoy_wimboot_func {
1097 if [ "$grub_platform" = "pc" ]; then
1098 set vt_wimkernel=wimboot.x86_64.xz
1100 if [ "$grub_cpu" = "i386" ]; then
1101 set vt_wimkernel=wimboot.i386.efi.xz
1103 set vt_wimkernel=wimboot.x86_64.xz
1107 if vt_is_standard_winiso (loop); then
1108 echo -e "\n==================== VENTOY WIMBOOT ==================\n"
1109 vtoy_windows_wimboot
1111 vt_sel_winpe_wim (loop)
1112 if [ -n "$vtoy_pe_wim_path" ]; then
1113 echo -e "\n==================== VENTOY WIMBOOT ==================\n"
1116 vt_load_file_to_mem "auto" $vtoy_path/common_bcd.xz vtoy_pe_bcd_mem
1119 for vsdi in "boot/boot.sdi" "2K10/FONTS/boot.sdi" "SSTR/boot.sdi" "ISPE/BOOT.SDI" \
1120 "boot/uqi.sdi" "ISYL/boot.sdi" "WEPE/WEPE.SDI" ; do
1121 if [ -F "(loop)/$vsdi" ]; then
1122 set vt_sdi_path=$vsdi
1127 if [ "$grub_platform" = "pc" ]; then
1128 vt_load_file_to_mem "auto" $vtoy_path/common_bootmgr.xz vtoy_pe_bootmgr_mem
1129 vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 1
1131 vtoy_winpe_wimboot "$vtoy_pe_wim_path" "$vt_sdi_path" 0
1139 function legacy_windows_menu_func {
1142 unset vt_cur_wimboot_mode
1143 if vt_check_mode 4 "$vt_chosen_name"; then
1144 set vt_cur_wimboot_mode=1
1147 if [ "$ventoy_compatible" = "NO" -o "$vt_cur_wimboot_mode" = "1" ]; then
1148 if [ "$ventoy_fs_probe" = "iso9660" ]; then
1150 vt_iso9660_nojoliet 1
1151 loopback loop "$1$2"
1154 for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD" "boot/bce"; do
1155 vt_windows_collect_wim_patch bcd (loop)/$file
1158 distro_specify_wim_patch
1160 vt_windows_count_wim_patch vt_wim_cnt
1161 if [ $vt_wim_cnt -eq 0 ]; then
1162 distro_specify_wim_patch_phase2
1166 if [ -z "$vt_cur_wimboot_mode" ]; then
1167 locate_wim "${chosen_path}"
1171 vt_windows_chain_data "${1}${chosen_path}"
1174 if [ "$vt_cur_wimboot_mode" = "1" ]; then
1178 if [ -n "$vtoy_chain_mem_addr" ]; then
1179 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1180 if [ "$ventoy_compatible" = "NO" ]; then
1181 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1183 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1187 echo "chain empty failed"
1192 function legacy_linux_menu_func {
1193 if [ "$ventoy_compatible" = "NO" ]; then
1195 if [ "$ventoy_fs_probe" = "udf" ]; then
1197 set ventoy_fs_probe=iso9660
1198 loopback loop "$1$2"
1202 if vt_syslinux_need_nojoliet "$1$2"; then
1203 vt_iso9660_nojoliet 1
1205 loopback loop "$1$2"
1208 vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"
1210 vt_linux_clear_initrd
1212 if [ -d (loop)/pmagic ]; then
1213 vt_linux_specify_initrd_file /pmagic/initrd.img
1215 for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
1216 if [ -d (loop)/$dir ]; then
1217 vt_linux_parse_initrd_isolinux (loop)/$dir/
1222 # special process for special distros
1224 if [ -d (loop)/arch/boot/syslinux ]; then
1225 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
1226 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
1227 elif [ -d (loop)/anarchy/boot/syslinux ]; then
1228 vt_linux_parse_initrd_isolinux (loop)/anarchy/boot/syslinux/ /anarchy/
1231 elif [ -d (loop)/manjaro ]; then
1232 if [ -e (loop)/boot/grub/kernels.cfg ]; then
1233 vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
1235 elif [ -e (loop)/boot/grub/grub.cfg ]; then
1236 vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
1239 distro_specify_initrd_file
1241 vt_linux_initrd_count vtcount
1242 if [ $vtcount -eq 0 ]; then
1243 if [ -d (loop)/rancheros ]; then
1244 vt_linux_parse_initrd_isolinux (loop)/boot/ /boot/isolinux/
1247 distro_specify_initrd_file_phase2
1253 vt_linux_chain_data "${1}${chosen_path}"
1256 if [ -n "$vtoy_chain_mem_addr" ]; then
1258 if vt_check_mode 3 "$vt_chosen_name"; then
1260 elif vt_str_begin "$vt_volume_id" "HOLO_"; then
1261 if [ -d (loop)/loader/entries ]; then
1266 if [ -n "$vtGrub2Mode" ]; then
1267 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1271 set vtback_root=$root
1273 set vtback_theme=$theme
1276 vt_trailer_cpio "$vtoy_iso_part" "$vt_chosen_path" noinit
1277 vt_set_boot_opt rdinit=/vtoy/vtoy
1280 set vtback_cfg_find=0
1281 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
1282 if [ -e "$cfg" ]; then
1283 set vtback_cfg_find=1
1288 if [ $vtback_cfg_find -eq 0 ]; then
1289 if [ -f (loop)/loader/loader.conf -a -d (loop)/loader/entries ]; then
1290 if vt_str_begin "$vt_volume_id" "HOLO_"; then
1292 vt_systemd_menu (loop,2) vt_sys_menu_mem
1294 vt_systemd_menu (loop) vt_sys_menu_mem
1296 set vtback_cfg_find=1
1297 configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
1301 if [ $vtback_cfg_find -eq 0 ]; then
1302 if [ -f (loop)/boot/isolinux/syslnx64.cfg ]; then
1303 syslinux_configfile (loop)/boot/isolinux/syslnx64.cfg
1304 set vtback_cfg_find=1
1305 elif [ -f (loop)/boot/syslinux/porteus.cfg ]; then
1306 syslinux_configfile (loop)/boot/syslinux/porteus.cfg
1307 set vtback_cfg_find=1
1312 set root=$vtback_root
1313 set theme=$vtback_theme
1317 ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1318 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1322 echo "chain empty failed"
1328 function legacy_unix_menu_func {
1329 ventoy_unix_comm_proc $1 "${chosen_path}"
1331 if [ -n "$vtoy_chain_mem_addr" ]; then
1332 #ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
1333 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1336 echo "chain empty failed"
1342 function legacy_iso_menu_func {
1343 set chosen_path="$2"
1345 vt_select_auto_install "${chosen_path}"
1346 vt_select_persistence "${chosen_path}"
1348 if [ -n "$vtcompat" ]; then
1349 set ventoy_compatible=YES
1351 elif vt_check_mode 1 "$vt_chosen_name"; then
1352 set ventoy_compatible=YES
1354 vt_check_compatible (loop)
1357 vt_img_sector "${1}${chosen_path}"
1359 if [ "$ventoy_fs_probe" = "iso9660" ]; then
1360 vt_select_conf_replace "${1}" "${chosen_path}"
1363 if [ "$vtoy_os" = "Windows" ]; then
1364 vt_check_compatible_pe (loop)
1365 legacy_windows_menu_func "$1" "${chosen_path}"
1366 elif [ "$vtoy_os" = "Unix" ]; then
1367 legacy_unix_menu_func "$1" "${chosen_path}"
1369 vt_check_compatible_linux (loop)
1370 legacy_linux_menu_func "$1" "${chosen_path}"
1372 vt_secondary_recover_mode
1375 function legacy_iso_memdisk {
1377 linux16 $vtoy_path/memdisk iso raw
1378 echo "Loading ISO file to memory ..."
1384 function iso_endless_os_proc {
1385 if [ -d (loop)/ ]; then
1389 loopback loop "${1}${2}"
1390 vt_img_sector "${1}${2}"
1392 vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"
1393 vt_trailer_cpio "$1" "$2" noinit
1397 vt_set_boot_opt '@kparams' rdinit=/vtoy/vtoy
1400 set ventoy_bls_bootdev=/boot
1401 set ventoy_loading_tip="Loading files ......"
1404 configfile (loop)/endless/grub/grub.cfg
1407 unset ventoy_bls_bootdev
1408 unset ventoy_loading_tip
1414 function ventoy_iso_busybox_ver {
1416 if [ "$VTOY_EFI_ARCH" = "aa64" ]; then
1417 set ventoy_busybox_ver=a64
1418 elif [ "$VTOY_EFI_ARCH" = "mips" ]; then
1419 set ventoy_busybox_ver=m64
1421 set ventoy_busybox_ver=32
1423 #special process for deepin-live iso
1424 if [ "$vt_chosen_size" = "403701760" ]; then
1425 if vt_str_str "$vt_chosen_path" "/deepin-live"; then
1426 set ventoy_busybox_ver=64
1428 elif vt_str_begin "$vt_volume_id" "PHOTON_"; then
1429 set ventoy_busybox_ver=64
1430 elif vt_str_begin "$vt_volume_id" "smgl-test-quinq-x86_64"; then
1431 set ventoy_busybox_ver=64
1432 elif vt_str_begin "$vt_volume_id" "LDiagBootable"; then
1433 set ventoy_busybox_ver=64
1434 elif vt_str_begin "$vt_volume_id" "KAOS_"; then
1435 set ventoy_busybox_ver=64
1442 function iso_common_menuentry {
1446 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1448 vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space
1449 if [ $vt_volume_space -NE $vt_chosen_size ]; then
1450 vt_mod $vt_chosen_size 2048 vt_chosen_size_mod
1451 if [ $vt_chosen_size_mod -ne 0 ]; then
1452 echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n"
1453 echo -e "\n The size of the iso file \"$vt_chosen_size\" is invalid. File corrupted ?\n"
1454 echo -e " 此ISO文件的大小 \"$vt_chosen_size\" 有问题,请确认文件是否损坏。\n"
1455 echo -en "\n$VTLANG_ENTER_CONTINUE ..."
1460 if vt_check_password "${vt_chosen_path}"; then
1464 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1470 #secondary boot menu
1471 if vt_is_udf "${vtoy_iso_part}${vt_chosen_path}"; then
1472 set ventoy_fs_probe=udf
1474 set ventoy_fs_probe=iso9660
1475 ventoy_reset_nojoliet
1478 if [ -d (loop)/ ]; then
1481 loopback loop "${vtoy_iso_part}${vt_chosen_path}"
1487 if vt_need_secondary_menu "$vt_chosen_name"; then
1488 vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
1489 if [ "$VTOY_SECOND_EXIT" = "1" ]; then
1495 if vt_str_begin "$vt_volume_id" "Avira"; then
1496 vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
1499 ventoy_iso_busybox_ver
1501 #special process for Endless OS
1502 if vt_str_begin "$vt_volume_id" "Endless-OS"; then
1503 iso_endless_os_proc $vtoy_iso_part "$vt_chosen_path"
1504 elif vt_str_begin "$vt_volume_id" "TENS-Public"; then
1509 # auto memdisk mode for some special ISO files
1510 vt_iso_vd_id_parse "${vtoy_iso_part}${vt_chosen_path}"
1512 if vt_check_mode 0 "$vt_chosen_name"; then
1515 if [ "$grub_platform" = "pc" ]; then
1516 if vt_iso_vd_id_begin 1 0 "Memtest86+"; then
1518 elif vt_iso_vd_id_begin 0 1 "KolibriOS"; then
1524 if [ $vt_chosen_size -LE 67108864 ]; then
1525 if vt_str_begin "$vt_chosen_name" "iKuai"; then
1533 if [ "$grub_platform" = "pc" ]; then
1534 if [ -n "$vtMemDiskBoot" ]; then
1535 legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1537 legacy_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
1540 if [ -n "$vtMemDiskBoot" ]; then
1541 uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1543 uefi_iso_menu_func $vtoy_iso_part "$vt_chosen_path"
1547 vt_secondary_recover_mode
1550 function miso_common_menuentry {
1551 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1553 if vt_check_password "${vt_chosen_path}"; then
1557 echo "memdisk mode boot for $vt_chosen_path"
1561 if [ "$grub_platform" = "pc" ]; then
1562 legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1564 uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
1569 function common_unsupport_menuentry {
1570 echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
1571 echo -e " 文件名中不能有中文或空格 \n"
1572 echo -en "\n$VTLANG_ENTER_EXIT ..."
1576 function miso_unsupport_menuentry {
1577 common_unsupport_menuentry
1580 function iso_unsupport_menuentry {
1581 common_unsupport_menuentry
1584 function wim_common_menuentry {
1585 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1587 if vt_check_password "${vt_chosen_path}"; then
1591 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1595 if vt_wim_check_bootable "${vtoy_iso_part}${vt_chosen_path}"; then
1596 vt_wim_chain_data "${vtoy_iso_part}${vt_chosen_path}"
1598 echo -e "\n This is NOT a bootable WIM file. \n"
1599 echo -e " 这不是一个可启动的 WIM 文件。\n"
1604 if [ -n "$vtoy_chain_mem_addr" ]; then
1605 if [ "$grub_platform" = "pc" ]; then
1606 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1609 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}
1614 echo "chain empty failed"
1619 function wim_unsupport_menuentry {
1620 common_unsupport_menuentry
1623 function efi_common_menuentry {
1624 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1626 if vt_check_password "${vt_chosen_path}"; then
1630 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1635 if vt_is_vlnk_name "${vt_chosen_path}"; then
1636 vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
1637 if [ -z "$vt_vlnk_dst" ]; then
1638 echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
1643 vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
1650 #first try with chainload
1652 set root=$vtoy_iso_part
1653 chainloader "${vt_vlnk_dst}"
1658 vt_concat_efi_iso "${vt_vlnk_dst}" vtoy_iso_buf
1659 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}
1665 function efi_unsupport_menuentry {
1666 common_unsupport_menuentry
1669 function vhdboot_common_func {
1670 vt_patch_vhdboot "$1"
1674 if [ -n "$vtoy_vhd_buf_addr" ]; then
1675 if [ "$grub_platform" = "pc" ]; then
1677 linux16 $vtoy_path/memdisk iso raw
1678 initrd16 mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
1683 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}
1688 echo "Please put the right ventoy_vhdboot.img file to the 1st partition"
1693 function vhd_common_menuentry {
1694 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1696 if vt_check_password "${vt_chosen_path}"; then
1700 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1705 if vt_is_vlnk_name "${vt_chosen_path}"; then
1706 vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
1707 if [ -z "$vt_vlnk_dst" ]; then
1708 echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
1713 vt_vlnk_dst="${vt_chosen_path}"
1714 if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
1715 if [ "$vtoy_iso_fs" != "ntfs" ]; then
1716 echo -e "!!! WARNING !!!\n"
1717 echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
1718 echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
1719 echo -en "\n$VTLANG_ENTER_CONTINUE ..."
1725 vhdboot_common_func "${vt_vlnk_dst}"
1728 function vhd_unsupport_menuentry {
1729 common_unsupport_menuentry
1732 function vtoyboot_common_func {
1736 vt_get_vtoy_type "${1}" vtoytype parttype AltBootPart
1738 if vt_str_begin $vtoytype vhd; then
1740 elif [ "$vtoytype" = "raw" ]; then
1742 elif [ "$vtoytype" = "vdi" ]; then
1746 if [ $vtoysupport -eq 1 ]; then
1747 if [ "$grub_platform" = "pc" ]; then
1748 if [ "$parttype" = "gpt" -a $AltBootPart -eq 0 ]; then
1749 echo "The OS in the vdisk was created in UEFI mode, but current is Legacy BIOS mode."
1750 echo "虚拟磁盘内的系统是在UEFI模式下创建的,而当前系统是Legacy BIOS模式,可能无法正常启动。"
1754 if [ "$parttype" = "mbr" -a $AltBootPart -eq 0 ]; then
1755 echo "The OS in the vdisk was created in Legacy BIOS mode, but current is UEFI mode."
1756 echo "虚拟磁盘内的系统是在Legacy BIOS模式下创建的,而当前系统是UEFI模式,可能无法正常启动。"
1761 vt_img_sector "${1}"
1762 vt_raw_chain_data "${1}"
1766 if [ -n "$vtoy_chain_mem_addr" ]; then
1767 if [ "$grub_platform" = "pc" ]; then
1768 vt_acpi_param ${vtoy_chain_mem_addr} 512
1769 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} bios80 sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1772 if vt_check_secureboot_var; then
1773 vt_acpi_param ${vtoy_chain_mem_addr} 512
1776 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}
1781 echo "chain empty failed!"
1785 echo "Unsupported vtoy type $vtoytype"
1790 function vtoy_common_menuentry {
1791 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
1793 if vt_check_password "${vt_chosen_path}"; then
1797 if ventoy_vcfg_proc "${vt_chosen_path}"; then
1802 if vt_is_vlnk_name "${vt_chosen_path}"; then
1803 vt_get_vlnk_dst "${vtoy_iso_part}${vt_chosen_path}" vt_vlnk_dst
1804 if [ -z "$vt_vlnk_dst" ]; then
1805 echo -e "\n### VLNK FILE NOT FOUND ###\n### VLNK 文件不存在 ###\n"
1810 vt_vlnk_dst="${vtoy_iso_part}${vt_chosen_path}"
1813 vtoyboot_common_func "${vt_vlnk_dst}"
1816 function vtoy_unsupport_menuentry {
1817 common_unsupport_menuentry
1821 #============================================================#
1822 # IMG file boot process #
1823 #============================================================#
1826 function only_uefi_tip {
1827 echo -e "\n This IMG file is only supported in UEFI mode. \n"
1828 echo -en "\n$VTLANG_ENTER_EXIT ..."
1832 function ventoy_img_easyos {
1833 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1834 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1836 loopback easysfs (vtimghd,1)/easy.sfs
1837 vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
1839 if [ -n "$vt_module_ver" ]; then
1840 for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
1841 if [ -e (easysfs)/lib/modules/$vt_module_ver/$mod ]; then
1842 vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
1850 vt_set_boot_opt rdinit=/vtoy/vtoy
1853 syslinux_configfile (vtimghd,1)/syslinux.cfg
1860 function ventoy_img_easyos2 {
1861 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1862 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1864 if [ -e (vtimghd,2)/easyos/easy.sfs ]; then
1865 loopback easysfs (vtimghd,2)/easyos/easy.sfs
1866 elif [ -d (vtimghd,2)/easyos/releases ]; then
1867 vt_fs_enum_1st_dir (vtimghd,2) /easyos/releases/ vt_dir_name
1868 loopback easysfs (vtimghd,2)/easyos/releases/$vt_dir_name/easy.sfs
1871 vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
1873 if [ -n "$vt_module_ver" ]; then
1874 for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
1875 if [ -e (easysfs)/lib/modules/$vt_module_ver/$mod ]; then
1876 vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
1884 vt_set_boot_opt rdinit=/vtoy/vtoy
1887 vt_limine_menu (vtimghd,1)/limine.cfg vt_sys_menu_mem
1888 configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
1895 function ventoy_img_volumio {
1896 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1897 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1902 vt_set_boot_opt rdinit=/vtoy/vtoy imgpart=/dev/ventoy2 bootpart=/dev/ventoy1
1905 syslinux_configfile (vtimghd,1)/syslinux.cfg
1911 function ventoy_img_openelec {
1914 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1915 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1917 loopback vtloopex $vtoy_efi_part/ventoy/vtloopex.cpio
1918 vt_img_extra_initrd_append (vtloopex)/$elec_ver/vtloopex.tar.xz
1920 if [ "$elec_ver" = "LibreELEC" ]; then
1921 if [ -f (vtimghd,1)/system ]; then
1922 loopback elecsfs (vtimghd,1)/system
1923 vt_get_lib_module_ver (elecsfs) /usr/lib/kernel-overlays/base/lib/modules/ vt_module_ver
1924 if [ -n "$vt_module_ver" ]; then
1925 for mod in "kernel/drivers/md/dm-mod.ko"; do
1926 if [ -e (elecsfs)/usr/lib/kernel-overlays/base/lib/modules/$vt_module_ver/$mod ]; then
1927 vt_img_extra_initrd_append (elecsfs)/usr/lib/kernel-overlays/base/lib/modules/$vt_module_ver/$mod
1937 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=$elec_ver
1940 set root=(vtimghd,1)
1941 syslinux_configfile (vtimghd,1)/syslinux.cfg
1945 loopback -d vtloopex
1950 function ventoy_img_freedombox {
1951 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1952 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1954 vt_get_lib_module_ver (vtimghd,1) /lib/modules/ vt_module_ver
1955 if [ -n "$vt_module_ver" ]; then
1956 vt_img_extra_initrd_append (vtimghd,1)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
1962 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=freedombox
1965 configfile (vtimghd,1)/boot/grub/grub.cfg
1971 function ventoy_img_paldo {
1972 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1973 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1978 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=paldo
1981 vt_fs_enum_1st_file (vtimghd,1) /loader/entries/ vt_paldo_entry_conf
1982 vt_file_basename $vt_paldo_entry_conf vtPaldoVer
1984 echo loading file...
1985 linux (vtimghd,1)/linux-${vtPaldoVer} root=/dev/ventoy1 rootfstype=vfat
1986 initrd (vtimghd,1)/initramfs-${vtPaldoVer}
1993 function ventoy_img_ubos {
1994 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1995 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
1997 vt_get_lib_module_ver (vtimghd,3) /lib/modules/ vt_module_ver
1998 if [ -n "$vt_module_ver" ]; then
1999 vt_img_extra_initrd_append (vtimghd,3)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko.xz
2005 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=ubos
2008 echo loading file...
2009 linux (vtimghd,2)/vmlinuz-linux root=/dev/ventoy3 rw
2010 initrd (vtimghd,2)/initramfs-linux.img
2017 function ventoy_img_recalbox {
2018 if [ $vtoy_img_max_part_end -GT $vt_chosen_size ]; then
2019 echo -e "\nPlease extend the img file size before boot it. \n"
2024 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2025 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2027 if [ -e (vtimghd,1)/boot/recalbox ]; then
2028 loopback recalbox (vtimghd,1)/boot/recalbox
2029 vt_get_lib_module_ver (recalbox) /lib/modules/ vt_module_ver
2030 if [ -n "$vt_module_ver" ]; then
2031 vt_img_extra_initrd_append (recalbox)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
2038 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=recalbox
2041 set root=(vtimghd,1)
2042 configfile (vtimghd,1)/boot/grub/grub.cfg
2048 function ventoy_img_esysrescue {
2049 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2050 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2055 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=esysrescue
2058 set root=(vtimghd,1)
2059 configfile (vtimghd,1)/boot/grub/grub.cfg
2065 function ventoy_img_batocera {
2066 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2067 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2072 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=batocera
2075 set root=(vtimghd,1)
2076 syslinux_configfile (vtimghd,1)/boot/syslinux/syslinux.cfg
2082 function ventoy_img_openwrt {
2083 if [ -e (vtimghd,2)/lib64 ]; then
2084 set ventoy_busybox_ver=64
2087 vt_fs_enum_1st_dir (vtimghd,2) /lib/modules/ vt_dir_name
2089 if [ -f (vtimghd,2)/lib/modules/$vt_dir_name/dm-mod.ko ]; then
2090 set openwrt_plugin_need=0
2091 vt_img_extra_initrd_append (vtimghd,2)/lib/modules/$vt_dir_name/dm-mod.ko
2092 if [ -f (vtimghd,2)/lib/modules/$vt_dir_name/dax.ko ]; then
2093 vt_img_extra_initrd_append (vtimghd,2)/lib/modules/$vt_dir_name/dax.ko
2096 set openwrt_plugin_need=1
2097 if [ ! -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
2099 echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
2100 echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
2101 echo -en "\n$VTLANG_ENTER_EXIT ..."
2108 if vt_img_check_range "${vtoy_iso_part}${vt_chosen_path}"; then
2112 echo -e "\n IMG file need processed. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
2113 echo -e " 此 IMG 文件必须处理之后才能支持。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
2114 echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
2120 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2121 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2123 if [ $openwrt_plugin_need -eq 1 ]; then
2124 if [ -f ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz ]; then
2125 vt_img_extra_initrd_append ${vtoy_iso_part}/ventoy/ventoy_openwrt.xz
2130 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=openwrt
2133 set root=(vtimghd,1)
2134 configfile (vtimghd,1)/boot/grub/grub.cfg
2140 function ventoy_img_tails {
2141 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2142 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2147 vt_set_boot_opt rdinit=/vtoy/vtoy live-media=/dev/dm-1 ventoyos=tails
2150 set root=(vtimghd,1)
2151 configfile (vtimghd,1)/efi/debian/grub.cfg
2157 function ventoy_img_fydeos {
2158 if [ "$grub_platform" = "pc" ]; then
2163 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=64"
2164 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2169 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=fydeos
2172 set grubdisk=vtimghd
2173 set grubpartA=(vtimghd,3)
2174 set grubpartB=(vtimghd,5)
2175 set linuxpartA=(sda,3)
2176 set linuxpartB=(sda,5)
2178 set root=(vtimghd,12)
2179 configfile (vtimghd,12)/efi/boot/grub.cfg
2191 function ventoy_img_cloudready {
2192 if [ "$grub_platform" = "pc" ]; then
2197 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=64"
2198 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2203 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=cloudready
2206 set grubdisk=vtimghd
2207 set grubpartA=(vtimghd,3)
2208 set grubpartB=(vtimghd,5)
2209 set linuxpartA=(sda,3)
2210 set linuxpartB=(sda,5)
2212 set root=(vtimghd,12)
2213 configfile (vtimghd,12)/efi/boot/grub.cfg
2226 function ventoy_img_fwts {
2227 vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
2228 vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
2233 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=fwts
2236 configfile $prefix/distro/fwts.cfg
2242 function ventoy_img_memtest86 {
2243 chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
2247 function img_unsupport_tip {
2248 echo -e "\n This IMG file is NOT supported now. \n"
2249 echo -e " 当前不支持启动此 IMG 文件 \n"
2250 echo -en "\n$VTLANG_ENTER_EXIT ..."
2254 function legacy_img_memdisk {
2255 linux16 $vtoy_path/memdisk
2256 echo "Loading img file to memory ..."
2263 function img_common_menuentry {
2264 set ventoy_compatible=YES
2265 set ventoy_busybox_ver=32
2266 unset LoadIsoEfiDriver
2268 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
2270 if vt_check_password "${vt_chosen_path}"; then
2274 if ventoy_vcfg_proc "${vt_chosen_path}"; then
2278 if [ "$grub_platform" = "pc" ]; then
2279 if vt_check_mode 0 "$vt_chosen_name"; then
2280 legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
2285 loopback vtimghd "${vtoy_iso_part}${vt_chosen_path}"
2286 vt_img_sector "${vtoy_iso_part}${vt_chosen_path}"
2288 vt_img_part_info (vtimghd)
2290 set vtback_root=$root
2293 set vtback_theme=$theme
2296 vt_img_extra_initrd_reset
2299 vt_get_fs_label (vtimghd,1) vtImgHd1Label
2301 if [ "$vtImgHd1Label" = "STATE" ]; then
2302 vt_get_fs_label (vtimghd,3) vtImgHd3Label
2303 elif [ -d (vtimghd,2)/lib ]; then
2304 vt_get_fs_label (vtimghd,2) vtImgHd2Label
2307 if [ -z "$vtImgHd1Label" ]; then
2308 if [ -d (vtimghd,2)/efi ]; then
2309 vt_get_fs_label (vtimghd,3) vtImgHd3Label
2310 elif [ -d (vtimghd,12)/efi ]; then
2311 vt_get_fs_label (vtimghd,3) vtImgHd3Label
2315 if [ -e (vtimghd,1)/etc/hostname ]; then
2316 vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
2319 if vt_str_begin "$vtImgHd3Label" "ROOT-"; then
2320 if [ -f (vtimghd,3)/etc/os-release.d/ID ]; then
2321 vt_1st_line (vtimghd,3)/etc/os-release.d/ID vt_release_line1
2322 if vt_str_begin "$vt_release_line1" "FydeOS"; then
2325 ventoy_img_cloudready
2327 elif [ -f (vtimghd,3)/etc/cloudready-release ]; then
2328 ventoy_img_cloudready
2329 elif [ -f (vtimghd,3)/etc/chrome_dev.conf ]; then
2330 ventoy_img_cloudready
2332 elif vt_str_begin "$vtImgHd3Label" "fwts-result"; then
2334 elif vt_str_begin "$vtImgHd1Label" "LAKKA"; then
2335 ventoy_img_openelec lakka
2336 elif vt_str_begin "$vtImgHd1Label" "LIBREELEC"; then
2337 ventoy_img_openelec LibreELEC
2338 elif vt_str_begin "$vtImgHd1Label" "paldo-live"; then
2340 elif vt_str_begin "$vtImgHostname" "freedombox"; then
2341 ventoy_img_freedombox
2342 elif vt_str_begin "$vtImgHd1Label" "BATOCERA"; then
2344 elif vt_str_begin "$vtImgHd1Label" "Tails"; then
2346 elif [ "$vtImgHd2Label" = "RECALBOX" -o "$vtImgHd1Label" = "RECALBOX" ]; then
2348 elif [ "$vtImgHd1Label" = "ESYSRESCUE" ]; then
2349 ventoy_img_esysrescue
2350 elif [ -e (vtimghd,1)/easy.sfs ]; then
2352 elif [ -d (vtimghd,2)/easyos ]; then
2354 elif [ -e (vtimghd,1)/volumio.initrd ]; then
2356 elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
2358 elif [ -f (vtimghd,2)/etc/openwrt_version ]; then
2361 if [ -f (vtimghd,1)/efi/boot/mt86.png ]; then
2362 if [ "$grub_platform" = "pc" ]; then
2368 vt_linux_chain_data "${vtoy_iso_part}${vt_chosen_path}"
2369 ventoy_acpi_param ${vtoy_chain_mem_addr} 512
2370 if [ "$grub_platform" = "pc" ]; then
2371 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
2374 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}
2381 set root=$vtback_root
2383 set theme=$vtback_theme
2385 set ventoy_compatible=NO
2388 function img_unsupport_menuentry {
2389 common_unsupport_menuentry
2392 function mimg_common_menuentry {
2393 vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
2395 if vt_check_password "${vt_chosen_path}"; then
2399 echo "memdisk mode boot for $vt_chosen_path"
2403 if [ "$grub_platform" = "pc" ]; then
2404 legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
2406 vt_load_img_memdisk "$vtoy_iso_part$vt_chosen_path" vtoy_img_buf
2408 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}
2414 #############################################################
2415 #############################################################
2416 #############################################################
2417 ####### Main Process ###########
2418 #############################################################
2419 #############################################################
2420 #############################################################
2422 set VENTOY_VERSION="1.1.05"
2424 #ACPI not compatible with Window7/8, so disable by default
2425 set VTOY_PARAM_NO_ACPI=1
2427 # Default menu display mode, you can change it as you want.
2430 set VTOY_DEFAULT_MENU_MODE=0
2432 set VTOY_MEM_DISK_STR="[Memdisk]"
2433 set VTOY_ISO_RAW_STR="Compatible Mode"
2434 set VTOY_GRUB2_MODE_STR="GRUB2 Mode"
2435 set VTOY_WIMBOOT_MODE_STR="WIMBOOT Mode"
2436 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
2438 set VTOY_F2_CMD="vt_browser_disk"
2439 set VTOY_F4_CMD="ventoy_localboot"
2440 set VTOY_F5_CMD="ventoy_diagnosis"
2441 set VTOY_F6_CMD="ventoy_ext_menu"
2442 set VTOY_HELP_CMD="ventoy_show_help"
2443 set VTOY_CHKSUM_CMD="ventoy_checksum"
2444 set VTOY_HELP_TXT_LANGUAGE="en_US"
2445 set VTOY_CHKSUM_FILE_PATH="X"
2446 set VTOY_LANG_CMD="ventoy_language"
2449 if [ "$grub_platform" = "pc" ]; then
2450 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
2452 if [ "$grub_cpu" = "i386" ]; then
2453 set VTOY_EFI_ARCH=ia32
2454 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION IA32 www.ventoy.net"
2455 elif [ "$grub_cpu" = "arm64" ]; then
2456 set VTOY_EFI_ARCH=aa64
2457 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION AA64 www.ventoy.net"
2458 elif [ "$grub_cpu" = "mips64el" ]; then
2459 set VTOY_EFI_ARCH=mips
2460 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION MIPS www.ventoy.net"
2462 set VTOY_EFI_ARCH=x64
2463 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION UEFI www.ventoy.net"
2467 vt_device $root vtoy_dev
2469 if [ "$vtoy_dev" = "tftp" ]; then
2470 set vtoy_path=($root)
2471 for vtid in 0 1 2 3; do
2472 if [ -f (hd$vtid,2)/ventoy/ventoy.cpio ]; then
2473 set vtoy_iso_part=(hd$vtid,1)
2474 set vtoy_efi_part=(hd$vtid,2)
2481 if [ -n "$vtoy_efi_part" ]; then
2482 vt_load_file_to_mem "auto" $vtoy_efi_part/grub/fonts/unicode.pf2 vtoy_font_mem
2483 loadfont mem:${vtoy_font_mem_addr}:size:${vtoy_font_mem_size}
2486 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
2487 set vt_plugin_path=$vtoy_iso_part
2489 set vt_plugin_path=$prefix
2490 vt_load_plugin $vt_plugin_path
2493 if [ "$prefix" = "(ventoydisk)/grub" ]; then
2494 set vtoy_path=(ventoydisk)/ventoy
2496 set vtoy_path=($root)/ventoy
2499 set vtoydev=$vtoy_dev
2500 set vtoy_iso_part=($vtoy_dev,1)
2501 set vtoy_efi_part=($vtoy_dev,2)
2503 vt_load_file_to_mem "auto" $prefix/fonts/unicode.pf2 vtoy_font_mem
2504 loadfont mem:${vtoy_font_mem_addr}:size:${vtoy_font_mem_size}
2506 set vt_plugin_path=$vtoy_iso_part
2509 #Load Partition Table
2510 vt_load_part_table $vtoydev
2512 #Load menu lang file
2513 ventoy_load_menu_lang_file
2516 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
2518 vt_load_plugin $vtoy_iso_part
2521 vt_check_json_path_case $vtoy_iso_part
2524 if [ -n "$VTOY_MENU_LANGUAGE" ]; then
2525 vt_init_menu_lang "$VTOY_MENU_LANGUAGE"
2527 vt_init_menu_lang en_US
2530 if [ -n "$VTOY_MENU_TIMEOUT" ]; then
2531 set timeout=$VTOY_MENU_TIMEOUT
2536 if [ -f $vtoy_iso_part/ventoy/ventoy_wimboot.img ]; then
2537 vt_load_wimboot $vtoy_iso_part/ventoy/ventoy_wimboot.img
2538 elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
2539 vt_load_wimboot $vtoy_efi_part/ventoy/ventoy_wimboot.img
2542 if [ -f $vtoy_iso_part/ventoy/ventoy_vhdboot.img ]; then
2543 vt_load_vhdboot $vtoy_iso_part/ventoy/ventoy_vhdboot.img
2544 elif [ -f $vtoy_efi_part/ventoy/ventoy_vhdboot.img ]; then
2545 vt_load_vhdboot $vtoy_efi_part/ventoy/ventoy_vhdboot.img
2549 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
2550 set VTOY_F3_CMD="vt_dynamic_menu 1 1"
2552 set VTOY_F3_CMD="vt_dynamic_menu 1 0"
2555 terminal_output console
2557 if [ -n "$vtoy_gfxmode" ]; then
2558 set gfxmode=$vtoy_gfxmode
2561 set gfxmode=1024x768
2566 if [ "$vtoy_display_mode" = "CLI" ]; then
2567 terminal_output console
2568 elif [ "$vtoy_display_mode" = "serial" ]; then
2569 if [ -n "$vtoy_serial_param" ]; then
2570 serial $vtoy_serial_param
2572 terminal_input serial
2573 terminal_output serial
2574 elif [ "$vtoy_display_mode" = "serial_console" ]; then
2575 if [ -n "$vtoy_serial_param" ]; then
2576 serial $vtoy_serial_param
2578 terminal_input serial console
2579 terminal_output serial console
2581 if [ "$vtoy_gfxmode" = "max" ]; then
2582 set gfxmode=1024x768
2583 terminal_output gfxterm
2586 vt_get_video_mode 0 vtCurMode
2587 terminal_output console
2588 set gfxmode=$vtCurMode
2589 terminal_output gfxterm
2590 elif [ "$vtoy_res_fit" = "1" ]; then
2591 terminal_output gfxterm
2594 if [ -n "$vtoy_theme" ]; then
2597 set theme=$prefix/themes/ventoy/theme.txt
2599 terminal_output gfxterm
2602 if [ "$grub_platform" = "efi" ]; then
2603 set mouse_delta=4000
2604 # terminal_input --append mouse
2607 if [ -n "$VTOY_DEFAULT_KBD_LAYOUT" ]; then
2608 set_keyboard_layout "$VTOY_DEFAULT_KBD_LAYOUT"
2611 if [ -n "$VTOY_PLUGIN_PATH_CASE_MISMATCH" ]; then
2613 echo "$VTOY_PLUGIN_PATH_CASE_MISMATCH"
2614 echo -e "\n\nPath case does not match! ventoy directory and ventoy.json MUST be all lowercase!"
2615 echo -e "\n路径大小写不匹配!ventoy 目录和 ventoy.json 文件的名字必须是全部小写,请修正!"
2616 echo -e "\n\npress ENTER to continue (请按回车键继续) ..."
2620 if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
2622 if [ -n "$VTOY_PLUGIN_ENCODE_ERROR" ]; then
2623 echo -e "\n Encoding type for ventoy.json is not supported, please convert to UTF-8.\n"
2624 echo -e " ventoy.json 文件编码格式不支持,请转换为 UTF-8 编码格式!\n"
2626 echo -e "\n Syntax error detected in ventoy.json, please check! \n"
2627 echo -e " ventoy.json 文件中有语法错误,所有配置都不会生效,请检查!\n"
2630 echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
2635 for vtTFile in ventoy.json ventoy_grub.cfg; do
2636 if [ -f $vtoy_efi_part/ventoy/$vtTFile ]; then
2638 echo -e "\n You need to put $vtTFile in the 1st partition which hold the ISO files.\n"
2639 echo -e " $vtTFile 放错分区了,请放到镜像分区里的 ventoy 目录下(此目录需要手动创建)!\n"
2640 echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
2645 #clear all input key before show main menu
2648 #export necessary variable
2656 export vtoy_iso_part
2657 export vtoy_efi_part
2658 export VENTOY_VERSION
2659 export VTOY_CUR_VIDEO_MODE
2660 export VTOY_EFI_ARCH
2661 export VTOY_MEM_DISK_STR
2662 export VTOY_ISO_RAW_STR
2663 export VTOY_GRUB2_MODE_STR
2664 export VTOY_WIMBOOT_MODE_STR
2665 export VTOY_ISO_UEFI_DRV_STR
2670 export VTOY_HELP_CMD
2671 export VTOY_CHKSUM_CMD
2672 export VTOY_HELP_TXT_LANGUAGE
2673 export VTOY_CHKSUM_FILE_PATH
2674 export VTOY_LANG_CMD
2677 #colect all image files (iso files)
2678 set ventoy_img_count=0
2679 vt_list_img $vtoy_iso_part ventoy_img_count
2682 if [ $ventoy_img_count -gt 0 ]; then
2683 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
2689 if [ -n "$VTOY_NO_ISO_TIP" ]; then
2690 NO_ISO_MENU="No ISO or supported IMG files found, $VTOY_NO_ISO_TIP"
2691 elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
2692 NO_ISO_MENU="No ISO or supported IMG files found, please check VTOY_DEFAULT_SEARCH_ROOT"
2694 NO_ISO_MENU="No ISO or supported IMG files found"
2696 menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
2697 echo -e "\n Rebooting ... "
2703 #special VTOY_DEFAULT_IMAGE process
2704 if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
2705 if regexp --set 1:vtHotkey --set 2:vtDefault "(F[2-9])>(.*)" "$VTOY_DEFAULT_IMAGE"; then
2707 set default="$vtDefault"
2708 if [ -z "$VTOY_MENU_TIMEOUT" ]; then
2711 set timeout=$VTOY_MENU_TIMEOUT
2719 if [ "$vtHotkey" = "F2" ]; then
2722 elif [ "$vtHotkey" = "F4" ]; then
2724 elif [ "$vtHotkey" = "F5" ]; then
2726 elif [ "$vtHotkey" = "F6" ]; then