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 function ventoy_pause {
20 if [ -n "${vtdebug_flag}" ]; then
21 echo "press Enter to continue ......"
26 function ventoy_debug_pause {
27 if [ -n "${vtdebug_flag}" ]; then
28 echo "press Enter to continue ......"
33 function ventoy_cli_console {
34 if [ "$grub_platform" = "pc" ]; then
35 #terminal_output vga_text
36 terminal_output console
38 if [ "$vtoy_display_mode" != "CLI" ]; then
39 terminal_output console
44 function ventoy_gui_console {
45 if [ "$grub_platform" = "pc" ]; then
46 if [ "$vtoy_display_mode" = "CLI" ]; then
47 terminal_output console
49 terminal_output gfxterm
52 if [ "$vtoy_display_mode" != "CLI" ]; then
53 terminal_output gfxterm
58 function ventoy_power {
59 configfile $prefix/power.cfg
62 function ventoy_diagnosis {
63 configfile $prefix/debug.cfg
66 function ventoy_localboot {
67 configfile $prefix/localboot.cfg
70 function ventoy_ext_menu {
71 if [ -e $vt_plugin_path/ventoy/ventoy_grub.cfg ]; then
72 set ventoy_new_context=1
73 configfile $vt_plugin_path/ventoy/ventoy_grub.cfg
74 unset ventoy_new_context
76 echo "ventoy_grub.cfg NOT exist."
77 echo -e "\npress ENTER to exit ..."
82 function get_os_type {
85 for file in "efi/microsoft/boot/bcd" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com" ; do
86 if vt_file_exist_nocase (loop)/$file; then
92 if [ "$vtoy_os" = "Linux" ]; then
93 if vt_strstr "$vt_system_id" "FreeBSD"; then
95 elif [ -e (loop)/bin/freebsd-version ]; then
100 if [ -n "${vtdebug_flag}" ]; then
105 function vt_check_compatible_pe {
106 #Check for PE without external tools
107 if [ -f $1/HBCD_PE.ini ]; then
108 set ventoy_compatible=YES
112 function locate_initrd {
113 vt_linux_locate_initrd
115 if [ -n "${vtdebug_flag}" ]; then
121 function locate_wim {
122 vt_windows_locate_wim_patch (loop)
124 if [ -n "${vtdebug_flag}" ]; then
125 echo '###############################################'
127 echo '###############################################'
132 function distro_specify_wim_patch {
133 if [ -d (loop)/h3pe ]; then
134 vt_windows_collect_wim_patch wim /BOOT/H3_10PE.WIM
135 vt_windows_collect_wim_patch wim /BOOT/H3_7PE.WIM
136 vt_windows_collect_wim_patch wim /BOOT/H3_8PE.WIM
137 vt_windows_collect_wim_patch wim /BOOT/H3_81PE.WIM
141 function distro_specify_wim_patch_phase2 {
142 if [ -f (loop)/boot/boot.wim ]; then
143 vt_windows_collect_wim_patch wim /boot/boot.wim
148 function distro_specify_initrd_file {
149 if [ -e (loop)/boot/all.rdz ]; then
150 vt_linux_specify_initrd_file /boot/all.rdz
151 elif [ -e (loop)/boot/xen.gz ]; then
152 if [ -e (loop)/install.img ]; then
153 vt_linux_specify_initrd_file /install.img
155 elif [ -d (loop)/casper ]; then
156 if [ -e (loop)/casper/initrd ]; then
157 vt_linux_specify_initrd_file /casper/initrd
159 if [ -e (loop)/casper/initrd-oem ]; then
160 vt_linux_specify_initrd_file /casper/initrd-oem
162 elif [ -e (loop)/boot/grub/initrd.xz ]; then
163 vt_linux_specify_initrd_file /boot/grub/initrd.xz
164 elif [ -e (loop)/initrd.gz ]; then
165 vt_linux_specify_initrd_file /initrd.gz
166 elif [ -e (loop)/slax/boot/initrfs.img ]; then
167 vt_linux_specify_initrd_file /slax/boot/initrfs.img
168 elif [ -e (loop)/pmagic/initrd.img ]; then
169 vt_linux_specify_initrd_file /pmagic/initrd.img
170 elif [ -e (loop)/boot/initrd.xz ]; then
171 vt_linux_specify_initrd_file /boot/initrd.xz
172 elif [ -f (loop)/boot/initrd ]; then
173 vt_linux_specify_initrd_file /boot/initrd
174 elif [ -f (loop)/boot/x86_64/loader/initrd ]; then
175 vt_linux_specify_initrd_file /boot/x86_64/loader/initrd
176 elif [ -f (loop)/boot/initramfs-x86_64.img ]; then
177 vt_linux_specify_initrd_file /boot/initramfs-x86_64.img
184 function distro_specify_initrd_file_phase2 {
185 if [ -f (loop)/boot/initrd.img ]; then
186 vt_linux_specify_initrd_file /boot/initrd.img
187 elif [ -f (loop)/Setup/initrd.gz ]; then
188 vt_linux_specify_initrd_file /Setup/initrd.gz
189 elif [ -f (loop)/isolinux/initramfs ]; then
190 vt_linux_specify_initrd_file /isolinux/initramfs
191 elif [ -f (loop)/boot/iniramfs.igz ]; then
192 vt_linux_specify_initrd_file /boot/iniramfs.igz
193 elif [ -f (loop)/initrd-x86_64 ]; then
194 vt_linux_specify_initrd_file /initrd-x86_64
195 elif [ -f (loop)/live/initrd.img ]; then
196 vt_linux_specify_initrd_file /live/initrd.img
197 elif [ -f (loop)/initrd.img ]; then
198 vt_linux_specify_initrd_file /initrd.img
199 elif [ -f (loop)/sysresccd/boot/x86_64/sysresccd.img ]; then
200 vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
201 elif [ -f (loop)/CDlinux/initrd ]; then
202 vt_linux_specify_initrd_file /CDlinux/initrd
203 elif [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
204 vt_linux_specify_initrd_file /parabola/boot/x86_64/parabolaiso.img
205 if [ -f (loop)/parabola/boot/i686/parabolaiso.img ]; then
206 vt_linux_specify_initrd_file /parabola/boot/i686/parabolaiso.img
208 elif [ -f (loop)/EFI/BOOT/initrd.img ]; then
210 vt_linux_specify_initrd_file /EFI/BOOT/initrd.img
211 if [ "$grub_platform" != "pc" ]; then
212 vt_add_replace_file 0 "initrd.img"
214 elif [ -f (loop)/initrd ]; then
215 vt_linux_specify_initrd_file /initrd
216 elif [ -f (loop)/live/initrd1 ]; then
217 vt_linux_specify_initrd_file /live/initrd1
222 function ventoy_freebsd_proc {
223 if regexp "^12_[0-9]" $vt_volume_id; then
224 set vt_freebsd_ver=12.x
225 elif regexp "^11_[0-9]" $vt_volume_id; then
226 set vt_freebsd_ver=11.x
227 elif regexp "^10_[0-9]" $vt_volume_id; then
228 set vt_freebsd_ver=10.x
229 elif [ -e (loop)/bin/freebsd-version ]; then
230 vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
231 if regexp "\"12\.[0-9]-" $vt_userland_ver; then
232 set vt_freebsd_ver=12.x
233 elif regexp "\"11\.[0-9]-" $vt_userland_ver; then
234 set vt_freebsd_ver=11.x
235 elif regexp "\"10\.[0-9]-" $vt_userland_ver; then
236 set vt_freebsd_ver=10.x
239 set vt_freebsd_ver=12.x
242 if file --is-i386-kfreebsd (loop)/boot/kernel/kernel; then
243 set vt_freebsd_bit=32
245 set vt_freebsd_bit=64
248 if [ -n "${vtdebug_flag}" ]; then
249 echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
252 for file in "geom_nop" "ipmi"; do
253 if [ -e (loop)/boot/kernel/${file}.ko ]; then
259 vt_unix_replace_ko $vt_unix_ko (vtunix)/ventoy_unix/FreeBSD/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
260 vt_unix_replace_conf FreeBSD ${1}${chosen_path}
263 function ventoy_unix_comm_proc {
266 if [ "$ventoy_compatible" = "NO" ]; then
267 loopback vtunix $vtoy_efi_part/ventoy/ventoy_unix.cpio
269 set vt_unix_type=unknown
270 if vt_strstr "$vt_system_id" "FreeBSD"; then
271 ventoy_freebsd_proc $1 ${chosen_path}
272 elif [ -e (loop)/bin/freebsd-version ]; then
273 ventoy_freebsd_proc $1 ${chosen_path}
275 if [ -n "${vtdebug_flag}" ]; then
276 echo "Unknown unix type"
281 vt_unix_chain_data ${1}${chosen_path}
286 function uefi_windows_menu_func {
289 if [ "$ventoy_compatible" = "NO" ]; then
291 if [ "$ventoy_fs_probe" = "iso9660" ]; then
293 vt_iso9660_nojoliet 1
297 for file in "efi/microsoft/boot/bcd"; do
298 vt_windows_collect_wim_patch bcd (loop)/$file
301 vt_windows_count_wim_patch vt_wim_cnt
302 if [ $vt_wim_cnt -eq 0 ]; then
303 distro_specify_wim_patch_phase2
310 vt_windows_chain_data ${1}${chosen_path}
313 if [ -n "$vtoy_chain_mem_addr" ]; then
315 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
318 echo "chain empty failed"
323 function uefi_linux_menu_func {
324 if [ "$ventoy_compatible" = "NO" ]; then
326 if [ "$ventoy_fs_probe" = "udf" ]; then
328 set ventoy_fs_probe=iso9660
332 vt_load_cpio ${vtoy_path}/ventoy.cpio $2 $1
334 vt_linux_clear_initrd
336 if [ -d (loop)/pmagic ]; then
337 vt_linux_specify_initrd_file /pmagic/initrd.img
339 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"; do
340 if [ -e (loop)/$file ]; then
341 vt_linux_parse_initrd_grub file (loop)/$file
346 # special process for special distros
347 if [ -d (loop)/loader/entries ]; then
348 vt_linux_parse_initrd_grub dir (loop)/loader/entries/
349 elif [ -d (loop)/boot/grub ]; then
350 vt_linux_parse_initrd_grub dir (loop)/boot/grub/
353 distro_specify_initrd_file
355 vt_linux_initrd_count vtcount
356 if [ $vtcount -eq 0 ]; then
357 distro_specify_initrd_file_phase2
359 if [ "$vt_efi_dir" = "NO" ]; then
360 if [ -f (loop)/efi.img ]; then
361 vt_add_replace_file 0 "initrd"
368 if [ -d (loop)/loader/entries ]; then
369 vt_linux_get_main_initrd_index vtindex
371 if [ -d (loop)/arch ]; then
372 if [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
373 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
374 elif [ -f (loop)/boot/initramfs_x86_64.img ]; then
375 vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img"
377 elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
378 vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
379 elif [ -f (loop)/loader/entries/thinstation.conf ]; then
380 vt_add_replace_file $vtindex "boot\\initrd"
382 elif [ -d (loop)/EFI/boot/entries ]; then
383 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
384 vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
386 elif [ -e (loop)/syslinux/alt0/full.cz ]; then
387 vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
388 set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
393 vt_linux_chain_data ${1}${chosen_path}
395 if [ -n "$vtoy_chain_mem_addr" ]; then
397 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
400 echo "chain empty failed"
405 function uefi_unix_menu_func {
406 ventoy_unix_comm_proc $1 ${chosen_path}
408 if [ -n "$vtoy_chain_mem_addr" ]; then
410 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
413 echo "chain empty failed"
418 function uefi_iso_menu_func {
420 if [ -d (loop)/ ]; then
424 if [ -n "$vtisouefi" ]; then
425 set LoadIsoEfiDriver=on
427 elif vt_check_mode 2; then
428 set LoadIsoEfiDriver=on
430 unset LoadIsoEfiDriver
433 vt_chosen_img_path chosen_path
434 vt_select_auto_install ${chosen_path}
435 vt_select_persistence ${chosen_path}
437 if vt_is_udf ${1}${chosen_path}; then
438 set ventoy_fs_probe=udf
440 set ventoy_fs_probe=iso9660
441 vt_iso9660_nojoliet 0
444 loopback loop ${1}${chosen_path}
445 vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
448 if [ -d (loop)/EFI ]; then
450 elif [ -d (loop)/efi ]; then
456 if [ -n "$vtcompat" ]; then
457 set ventoy_compatible=YES
459 elif vt_check_mode 1; then
460 set ventoy_compatible=YES
462 vt_check_compatible (loop)
465 vt_img_sector ${1}${chosen_path}
467 if [ "$vtoy_os" = "Windows" ]; then
468 vt_check_compatible_pe (loop)
469 uefi_windows_menu_func $1 ${chosen_path}
470 elif [ "$vtoy_os" = "Unix" ]; then
471 uefi_unix_menu_func $1 ${chosen_path}
473 uefi_linux_menu_func $1 ${chosen_path}
479 function uefi_iso_memdisk {
480 vt_chosen_img_path chosen_path
482 echo 'Loading ISO file to memory ...'
483 vt_load_iso_to_mem ${1}${chosen_path} vtoy_iso_buf
486 chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
493 function legacy_windows_menu_func {
496 if [ "$ventoy_compatible" = "NO" ]; then
498 if [ "$ventoy_fs_probe" = "iso9660" ]; then
500 vt_iso9660_nojoliet 1
504 for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD"; do
505 vt_windows_collect_wim_patch bcd (loop)/$file
508 distro_specify_wim_patch
510 vt_windows_count_wim_patch vt_wim_cnt
511 if [ $vt_wim_cnt -eq 0 ]; then
512 distro_specify_wim_patch_phase2
519 vt_windows_chain_data ${1}${chosen_path}
522 if [ -n "$vtoy_chain_mem_addr" ]; then
523 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
526 echo "chain empty failed"
531 function legacy_linux_menu_func {
532 if [ "$ventoy_compatible" = "NO" ]; then
534 if [ "$ventoy_fs_probe" = "udf" ]; then
536 set ventoy_fs_probe=iso9660
540 vt_load_cpio $vtoy_path/ventoy.cpio $2 $1
542 vt_linux_clear_initrd
544 if [ -d (loop)/pmagic ]; then
545 vt_linux_specify_initrd_file /pmagic/initrd.img
547 for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
548 if [ -d (loop)/$dir ]; then
549 vt_linux_parse_initrd_isolinux (loop)/$dir/
554 # special process for special distros
556 if [ -d (loop)/arch/boot/syslinux ]; then
557 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
558 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
561 elif [ -d (loop)/manjaro ]; then
562 if [ -e (loop)/boot/grub/kernels.cfg ]; then
563 vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
565 elif [ -e (loop)/boot/grub/grub.cfg ]; then
566 vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
569 distro_specify_initrd_file
571 vt_linux_initrd_count vtcount
572 if [ $vtcount -eq 0 ]; then
573 distro_specify_initrd_file_phase2
579 vt_linux_chain_data ${1}${chosen_path}
582 if [ -n "$vtoy_chain_mem_addr" ]; then
583 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
586 echo "chain empty failed"
592 function legacy_unix_menu_func {
593 ventoy_unix_comm_proc $1 ${chosen_path}
595 if [ -n "$vtoy_chain_mem_addr" ]; then
596 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
599 echo "chain empty failed"
605 function legacy_iso_menu_func {
607 if [ -d (loop)/ ]; then
611 vt_chosen_img_path chosen_path
612 vt_select_auto_install ${chosen_path}
613 vt_select_persistence ${chosen_path}
615 if vt_is_udf ${1}${chosen_path}; then
616 set ventoy_fs_probe=udf
618 set ventoy_fs_probe=iso9660
619 vt_iso9660_nojoliet 0
622 loopback loop ${1}${chosen_path}
623 vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
626 if [ -n "$vtcompat" ]; then
627 set ventoy_compatible=YES
629 elif vt_check_mode 1; then
630 set ventoy_compatible=YES
632 vt_check_compatible (loop)
635 vt_img_sector ${1}${chosen_path}
637 if [ "$vtoy_os" = "Windows" ]; then
638 vt_check_compatible_pe (loop)
639 legacy_windows_menu_func $1 ${chosen_path}
640 elif [ "$vtoy_os" = "Unix" ]; then
641 legacy_unix_menu_func $1 ${chosen_path}
643 legacy_linux_menu_func $1 ${chosen_path}
647 function legacy_iso_memdisk {
648 vt_chosen_img_path chosen_path
650 linux16 $vtoy_path/memdisk iso raw
651 echo "Loading ISO file to memory ..."
652 initrd16 ${1}${chosen_path}
656 function iso_common_menuentry {
660 if [ "$grub_platform" = "pc" ]; then
661 if vt_check_mode 0; then
662 legacy_iso_memdisk $vtoy_iso_part
664 legacy_iso_menu_func $vtoy_iso_part
667 if vt_check_mode 0; then
668 uefi_iso_memdisk $vtoy_iso_part
670 uefi_iso_menu_func $vtoy_iso_part
675 function common_unsupport_menuentry {
676 echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
677 echo -e " 文件名中不能有中文或空格 \n"
678 echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
682 function iso_unsupport_menuentry {
683 common_unsupport_menuentry
686 function wim_common_menuentry {
687 vt_chosen_img_path chosen_path
688 vt_wim_chain_data ${vtoy_iso_part}${chosen_path}
692 if [ -n "$vtoy_chain_mem_addr" ]; then
693 if [ "$grub_platform" = "pc" ]; then
694 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
697 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
702 echo "chain empty failed"
707 function wim_unsupport_menuentry {
708 common_unsupport_menuentry
711 function efi_common_menuentry {
712 vt_chosen_img_path chosen_path
715 chainloader ${vtoy_iso_part}${chosen_path}
720 function efi_unsupport_menuentry {
721 common_unsupport_menuentry
726 #############################################################
727 #############################################################
728 #############################################################
729 ####### Main Process ###########
730 #############################################################
731 #############################################################
732 #############################################################
734 set VENTOY_VERSION="1.0.17"
736 # Default menu display mode, you can change it as you want.
739 set VTOY_DEFAULT_MENU_MODE=0
741 set VTOY_MEM_DISK_STR="[Memdisk]"
742 set VTOY_ISO_RAW_STR="Compatible Mode"
743 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
745 set VTOY_F2_CMD="ventoy_power"
746 set VTOY_F4_CMD="ventoy_localboot"
747 set VTOY_F5_CMD="ventoy_diagnosis"
748 set VTOY_F6_CMD="ventoy_ext_menu"
750 if [ "$grub_platform" = "pc" ]; then
751 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
753 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION UEFI www.ventoy.net"
756 vt_device $root vtoy_dev
758 if [ "$vtoy_dev" = "tftp" ]; then
759 set vtoy_path=($root)
760 for vtid in 0 1 2 3; do
761 if [ -d (hd$vtid,2)/ventoy ]; then
762 set vtoy_iso_part=(hd$vtid,1)
763 set vtoy_efi_part=(hd$vtid,2)
769 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
770 set vt_plugin_path=$vtoy_iso_part
772 set vt_plugin_path=$prefix
773 vt_load_plugin $vt_plugin_path
776 if [ "$prefix" = "(ventoydisk)/grub" ]; then
777 set vtoy_path=(ventoydisk)/ventoy
779 set vtoy_path=($root)/ventoy
782 set vtoy_iso_part=($vtoy_dev,1)
783 set vtoy_efi_part=($vtoy_dev,2)
785 set vt_plugin_path=$vtoy_iso_part
790 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
791 vt_load_plugin $vtoy_iso_part
794 if [ -n "$VTOY_MENU_TIMEOUT" ]; then
795 set timeout=$VTOY_MENU_TIMEOUT
800 if [ -f $vtoy_iso_part/ventoy/ventoy_wimboot.img ]; then
801 vt_load_wimboot $vtoy_iso_part/ventoy/ventoy_wimboot.img
802 elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
803 vt_load_wimboot $vtoy_efi_part/ventoy/ventoy_wimboot.img
807 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
808 set VTOY_F3_CMD="vt_dynamic_menu 1 1"
809 set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Debug F6:ExMenu"
811 set VTOY_F3_CMD="vt_dynamic_menu 1 0"
812 set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Debug F6:ExMenu"
816 if [ -n "$vtoy_gfxmode" ]; then
817 set gfxmode=$vtoy_gfxmode
819 set gfxmode=1920x1080,1366x768,1024x768
822 if [ "$vtoy_display_mode" = "CLI" ]; then
823 terminal_output console
825 if [ -n "$vtoy_theme" ]; then
826 set theme=$vtoy_theme
828 set theme=$prefix/themes/ventoy/theme.txt
830 terminal_output gfxterm
833 #export necessary variable
839 export VENTOY_VERSION
844 #colect all image files (iso files)
845 set ventoy_img_count=0
846 vt_list_img $vtoy_iso_part ventoy_img_count
849 if [ $ventoy_img_count -gt 0 ]; then
850 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
856 if [ -n "$VTOY_NO_ISO_TIP" ]; then
857 NO_ISO_MENU="No ISO files found, $VTOY_NO_ISO_TIP"
858 elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
859 NO_ISO_MENU="No ISO files found, please check VTOY_DEFAULT_SEARCH_ROOT"
861 NO_ISO_MENU="No ISO files found"
863 menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
864 echo -e "\n Rebooting ... "