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 echo "press Enter to continue ......"
24 function ventoy_debug_pause {
25 if [ -n "${vtdebug_flag}" ]; then
26 echo "press Enter to continue ......"
31 function ventoy_cli_console {
32 if [ -z "$vtoy_display_mode" ]; then
33 terminal_output console
34 elif [ "$vtoy_display_mode" = "GUI" ]; then
35 terminal_output console
39 function ventoy_gui_console {
40 if [ -z "$vtoy_display_mode" ]; then
41 terminal_output gfxterm
42 elif [ "$vtoy_display_mode" = "GUI" ]; then
43 terminal_output gfxterm
47 function ventoy_power {
48 configfile $prefix/power.cfg
51 function ventoy_diagnosis {
53 configfile $prefix/debug.cfg
56 function ventoy_localboot {
57 configfile $prefix/localboot.cfg
60 function ventoy_ext_menu {
61 if [ -e $vt_plugin_path/ventoy/ventoy_grub.cfg ]; then
62 set ventoy_new_context=1
63 configfile $vt_plugin_path/ventoy/ventoy_grub.cfg
64 unset ventoy_new_context
66 echo "ventoy_grub.cfg NOT exist."
67 echo -e "\npress ENTER to exit ..."
72 function get_os_type {
75 for file in "efi/microsoft/boot/bcd" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com" ; do
76 if vt_file_exist_nocase (loop)/$file; then
82 if [ "$vtoy_os" = "Linux" ]; then
83 if vt_strstr "$vt_system_id" "FreeBSD"; then
85 set vt_unix_type=FreeBSD
86 elif [ -e (loop)/bin/freebsd-version ]; then
88 set vt_unix_type=FreeBSD
91 elif [ -e (loop)/boot/kernel/kernel ]; then
92 if file --is-x86-kfreebsd (loop)/boot/kernel/kernel; then
94 set vt_unix_type=FreeBSD
95 elif file --is-x86-knetbsd (loop)/boot/kernel/kernel; then
97 set vt_unix_type=NetBSD
102 if [ -n "${vtdebug_flag}" ]; then
107 function vt_check_compatible_pe {
108 #Check for PE without external tools
109 if [ -f $1/HBCD_PE.ini ]; then
110 set ventoy_compatible=YES
114 function locate_initrd {
115 vt_linux_locate_initrd
117 if [ -n "${vtdebug_flag}" ]; then
123 function locate_wim {
124 vt_windows_locate_wim_patch (loop)
126 if [ -n "${vtdebug_flag}" ]; then
127 echo '###############################################'
129 echo '###############################################'
134 function distro_specify_wim_patch {
135 if [ -d (loop)/h3pe ]; then
136 vt_windows_collect_wim_patch wim /BOOT/H3_10PE.WIM
137 vt_windows_collect_wim_patch wim /BOOT/H3_7PE.WIM
138 vt_windows_collect_wim_patch wim /BOOT/H3_8PE.WIM
139 vt_windows_collect_wim_patch wim /BOOT/H3_81PE.WIM
143 function distro_specify_wim_patch_phase2 {
144 if [ -f (loop)/boot/boot.wim ]; then
145 vt_windows_collect_wim_patch wim /boot/boot.wim
150 function distro_specify_initrd_file {
151 if [ -e (loop)/boot/all.rdz ]; then
152 vt_linux_specify_initrd_file /boot/all.rdz
153 elif [ -e (loop)/boot/xen.gz ]; then
154 if [ -e (loop)/install.img ]; then
155 vt_linux_specify_initrd_file /install.img
157 elif [ -d (loop)/casper ]; then
158 if [ -e (loop)/casper/initrd ]; then
159 vt_linux_specify_initrd_file /casper/initrd
161 if [ -e (loop)/casper/initrd.gz ]; then
162 vt_linux_specify_initrd_file /casper/initrd.gz
164 if [ -e (loop)/casper/initrd-oem ]; then
165 vt_linux_specify_initrd_file /casper/initrd-oem
167 elif [ -e (loop)/boot/grub/initrd.xz ]; then
168 vt_linux_specify_initrd_file /boot/grub/initrd.xz
169 elif [ -e (loop)/initrd.gz ]; then
170 vt_linux_specify_initrd_file /initrd.gz
171 elif [ -e (loop)/slax/boot/initrfs.img ]; then
172 vt_linux_specify_initrd_file /slax/boot/initrfs.img
173 elif [ -e (loop)/pmagic/initrd.img ]; then
174 vt_linux_specify_initrd_file /pmagic/initrd.img
175 elif [ -e (loop)/boot/initrd.xz ]; then
176 vt_linux_specify_initrd_file /boot/initrd.xz
177 elif [ -e (loop)/boot/initrd.gz ]; then
178 vt_linux_specify_initrd_file /boot/initrd.gz
179 elif [ -f (loop)/boot/initrd ]; then
180 vt_linux_specify_initrd_file /boot/initrd
181 elif [ -f (loop)/boot/x86_64/loader/initrd ]; then
182 vt_linux_specify_initrd_file /boot/x86_64/loader/initrd
183 elif [ -f (loop)/boot/initramfs-x86_64.img ]; then
184 vt_linux_specify_initrd_file /boot/initramfs-x86_64.img
185 elif [ -f (loop)/boot/isolinux/initramfs_data64.cpio.gz ]; then
186 vt_linux_specify_initrd_file /boot/isolinux/initramfs_data64.cpio.gz
191 if [ -f (loop)/isolinux/initrd.gz ]; then
192 vt_linux_specify_initrd_file /isolinux/initrd.gz
195 if [ "$vt_chosen_size" = "1133375488" ]; then
196 if [ -d (loop)/boot/grub/x86_64-efi ]; then
203 function distro_specify_initrd_file_phase2 {
204 if [ -f (loop)/boot/initrd.img ]; then
205 vt_linux_specify_initrd_file /boot/initrd.img
206 elif [ -f (loop)/Setup/initrd.gz ]; then
207 vt_linux_specify_initrd_file /Setup/initrd.gz
208 elif [ -f (loop)/isolinux/initramfs ]; then
209 vt_linux_specify_initrd_file /isolinux/initramfs
210 elif [ -f (loop)/boot/iniramfs.igz ]; then
211 vt_linux_specify_initrd_file /boot/iniramfs.igz
212 elif [ -f (loop)/initrd-x86_64 ]; then
213 vt_linux_specify_initrd_file /initrd-x86_64
214 elif [ -f (loop)/live/initrd.img ]; then
215 vt_linux_specify_initrd_file /live/initrd.img
216 elif [ -f (loop)/initrd.img ]; then
217 vt_linux_specify_initrd_file /initrd.img
218 elif [ -f (loop)/sysresccd/boot/x86_64/sysresccd.img ]; then
219 vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
220 elif [ -f (loop)/CDlinux/initrd ]; then
221 vt_linux_specify_initrd_file /CDlinux/initrd
222 elif [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
223 vt_linux_specify_initrd_file /parabola/boot/x86_64/parabolaiso.img
224 if [ -f (loop)/parabola/boot/i686/parabolaiso.img ]; then
225 vt_linux_specify_initrd_file /parabola/boot/i686/parabolaiso.img
227 elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
228 vt_linux_specify_initrd_file /hyperbola/boot/x86_64/hyperiso.img
229 if [ -f (loop)/hyperbola/boot/i686/hyperiso.img ]; then
230 vt_linux_specify_initrd_file /hyperbola/boot/i686/hyperiso.img
232 elif [ -f (loop)/EFI/BOOT/initrd.img ]; then
234 vt_linux_specify_initrd_file /EFI/BOOT/initrd.img
235 if [ "$grub_platform" != "pc" ]; then
236 vt_add_replace_file 0 "initrd.img"
238 elif [ -f (loop)/initrd ]; then
239 vt_linux_specify_initrd_file /initrd
240 elif [ -f (loop)/live/initrd1 ]; then
241 vt_linux_specify_initrd_file /live/initrd1
242 elif [ -f (loop)/isolinux/initrd.img ]; then
243 vt_linux_specify_initrd_file /isolinux/initrd.img
244 elif [ -f (loop)/isolinux/initrd.gz ]; then
245 vt_linux_specify_initrd_file /isolinux/initrd.gz
246 elif [ -f (loop)/syslinux/kernel/initramfs.gz ]; then
247 vt_linux_specify_initrd_file /syslinux/kernel/initramfs.gz
248 elif vt_strstr $vt_volume_id "Daphile"; then
249 vt_linux_parse_initrd_isolinux (loop)/isolinux/
250 elif [ -f (loop)/boot/rootfs.xz ]; then
251 vt_linux_specify_initrd_file /boot/rootfs.xz
252 if [ "$grub_platform" != "pc" ]; then
253 vt_add_replace_file 0 "minimal\\x86_64\\rootfs.xz"
255 elif [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
256 vt_linux_specify_initrd_file /arch/boot/x86_64/archiso.img
257 if [ "$grub_platform" != "pc" ]; then
258 vt_add_replace_file 0 "EFI\\archiso\\archiso.img"
260 elif [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
261 vt_linux_specify_initrd_file /blackarch/boot/x86_64/archiso.img
265 function ventoy_get_ghostbsd_ver {
267 # vt_parse_iso_create_date $1/${chosen_path} vt_create_date
268 # if regexp "^202005" "$vt_create_date"; then
269 # set vt_freebsd_ver=12.x
272 set vt_freebsd_ver=12.x
275 function ventoy_get_furybsd_ver {
276 if regexp "13\.[0-9]" "$2"; then
277 set vt_freebsd_ver=13.x
279 set vt_freebsd_ver=12.x
283 function ventoy_get_freenas_ver {
284 set vt_freebsd_ver=11.x
286 if [ -e (loop)/FreeNAS-MANIFEST ]; then
287 vt_parse_freenas_ver (loop)/FreeNAS-MANIFEST vt_freenas_ver
288 if regexp "^13\.[0-9]" "$vt_freenas_ver"; then
289 set vt_freebsd_ver=13.x
290 elif regexp "^12\.[0-9]" "$vt_freenas_ver"; then
291 set vt_freebsd_ver=12.x
292 elif regexp "^11\.[0-9]" "$vt_freenas_ver"; then
293 set vt_freebsd_ver=11.x
298 function ventoy_get_midnightbsd_ver {
299 set vt_freebsd_ver=11.x
302 function ventoy_freebsd_proc {
303 set vtFreeBsdDistro=FreeBSD
305 if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
306 ventoy_get_ghostbsd_ver $1 ${chosen_path}
307 elif vt_strstr "$vt_volume_id" "FREENAS"; then
308 ventoy_get_freenas_ver $1 ${chosen_path}
309 elif vt_strstr "$vt_volume_id" "FURYBSD"; then
310 ventoy_get_furybsd_ver $1 ${chosen_path}
311 elif regexp "^13_[0-9]" "$vt_volume_id"; then
312 set vt_freebsd_ver=13.x
313 elif regexp "^12_[0-9]" "$vt_volume_id"; then
314 set vt_freebsd_ver=12.x
315 elif regexp "^11_[0-9]" "$vt_volume_id"; then
316 set vt_freebsd_ver=11.x
317 elif regexp "^10_[0-9]" "$vt_volume_id"; then
318 set vt_freebsd_ver=10.x
319 elif regexp "^9_[0-9]" "$vt_volume_id"; then
320 set vt_freebsd_ver=9.x
321 elif [ -d (loop)/usr/midnightbsd-dist ]; then
322 ventoy_get_midnightbsd_ver $1 ${chosen_path}
323 set vtFreeBsdDistro=MidnightBSD
324 elif [ -e (loop)/bin/freebsd-version ]; then
325 vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
326 if regexp "\"13\.[0-9]-" "$vt_userland_ver"; then
327 set vt_freebsd_ver=13.x
328 elif regexp "\"12\.[0-9]-" "$vt_userland_ver"; then
329 set vt_freebsd_ver=12.x
330 elif regexp "\"11\.[0-9]-" "$vt_userland_ver"; then
331 set vt_freebsd_ver=11.x
332 elif regexp "\"10\.[0-9]-" "$vt_userland_ver"; then
333 set vt_freebsd_ver=10.x
334 elif regexp "\"9\.[0-9]-" "$vt_userland_ver"; then
335 set vt_freebsd_ver=9.x
337 elif [ -e (loop)/README.TXT ]; then
338 vt_1st_line (loop)/README.TXT vt_freebsd_line1
339 if regexp "FreeBSD 13\.[0-9]-" "$vt_freebsd_line1"; then
340 set vt_freebsd_ver=13.x
341 elif regexp "FreeBSD 12\.[0-9]-" "$vt_freebsd_line1"; then
342 set vt_freebsd_ver=12.x
343 elif regexp "FreeBSD 11\.[0-9]-" "$vt_freebsd_line1"; then
344 set vt_freebsd_ver=11.x
345 elif regexp "FreeBSD 10\.[0-9]-" "$vt_freebsd_line1"; then
346 set vt_freebsd_ver=10.x
347 elif regexp "FreeBSD 9\.[0-9]-" "$vt_freebsd_line1"; then
348 set vt_freebsd_ver=9.x
350 elif vt_strstr "${chosen_path}" "MidnightBSD"; then
351 set vt_freebsd_ver=9.x
353 set vt_freebsd_ver=12.x
356 set vt_freebsd_bit=64
357 for file in "/boot/kernel/kernel" "/boot/kernel/kernel.gz"; do
358 if [ -e (loop)/$file ]; then
359 if file --is-i386-kfreebsd (loop)/$file; then
360 set vt_freebsd_bit=32
366 if [ -n "${vtdebug_flag}" ]; then
367 echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
370 unset vt_unix_mod_path
371 for file in "/COPYRIGHT" "/FreeNAS-MANIFEST" "/version" "/etc/fstab"; do
372 if [ -e (loop)${file} ]; then
373 set vt_unix_mod_path=${file}
378 if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
379 set vtFreeBsdDistro=ClonOS
382 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
383 vt_unix_replace_conf FreeBSD ${1}${chosen_path}
386 function ventoy_unix_comm_proc {
389 if [ "$ventoy_compatible" = "NO" ]; then
390 loopback vtunix $vtoy_efi_part/ventoy/ventoy_unix.cpio
392 if [ "$vt_unix_type" = "FreeBSD" ]; then
393 ventoy_freebsd_proc $1 ${chosen_path}
394 elif [ "$vt_unix_type" = "NetBSD" ]; then
395 echo "NetBSD not supported"
400 if [ -n "${vtdebug_flag}" ]; then
401 echo "Unknown unix type"
406 vt_unix_chain_data ${1}${chosen_path}
411 function uefi_windows_menu_func {
414 if [ "$ventoy_compatible" = "NO" ]; then
416 if [ "$ventoy_fs_probe" = "iso9660" ]; then
418 vt_iso9660_nojoliet 1
422 for file in "efi/microsoft/boot/bcd"; do
423 vt_windows_collect_wim_patch bcd (loop)/$file
426 vt_windows_count_wim_patch vt_wim_cnt
427 if [ $vt_wim_cnt -eq 0 ]; then
428 distro_specify_wim_patch_phase2
435 vt_windows_chain_data ${1}${chosen_path}
438 if [ -n "$vtoy_chain_mem_addr" ]; then
440 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
443 echo "chain empty failed"
448 function uefi_linux_menu_func {
450 if [ "$ventoy_compatible" = "NO" ]; then
452 if [ "$ventoy_fs_probe" = "udf" ]; then
454 set ventoy_fs_probe=iso9660
458 vt_load_cpio ${vtoy_path}/ventoy.cpio $2 $1 "busybox=$ventoy_busybox_ver"
460 vt_linux_clear_initrd
462 if [ -d (loop)/pmagic ]; then
463 vt_linux_specify_initrd_file /pmagic/initrd.img
465 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
466 if [ -e (loop)/$file ]; then
467 vt_linux_parse_initrd_grub file (loop)/$file
472 # special process for special distros
473 if [ -d (loop)/loader/entries ]; then
474 vt_linux_parse_initrd_grub dir (loop)/loader/entries/
475 elif [ -d (loop)/boot/grub ]; then
476 vt_linux_parse_initrd_grub dir (loop)/boot/grub/
479 distro_specify_initrd_file
481 vt_linux_initrd_count vtcount
483 if [ $vtcount -eq 0 ]; then
484 distro_specify_initrd_file_phase2
486 if [ "$vt_efi_dir" = "NO" ]; then
487 if [ -f (loop)/efi.img ]; then
488 vt_add_replace_file 0 "initrd"
495 if [ -d (loop)/loader/entries ]; then
496 vt_linux_get_main_initrd_index vtindex
498 if [ -d (loop)/arch ]; then
499 if [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
500 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
501 elif [ -f (loop)/arch/boot/x86_64/initramfs-linux.img ]; then
502 vt_add_replace_file $vtindex "arch\\boot\\x86_64\\initramfs-linux.img"
503 elif [ -f (loop)/boot/initramfs_x86_64.img ]; then
504 vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img"
506 elif [ -d (loop)/blackarch ]; then
507 if [ -f (loop)/blackarch/boot/x86_64/archiso.img ]; then
508 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
510 elif [ -d (loop)/parabola ]; then
511 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
512 vt_add_replace_file $vtindex "EFI\\parabolaiso\\parabolaiso.img"
514 elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
515 vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
516 elif [ -f (loop)/loader/entries/thinstation.conf ]; then
517 vt_add_replace_file $vtindex "boot\\initrd"
518 elif [ -f (loop)/loader/entries/pisi-efi-x86_64.conf ]; then
519 vt_add_replace_file $vtindex "EFI\\pisi\\initrd.img"
521 elif [ -d (loop)/EFI/boot/entries ]; then
522 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
523 vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
524 elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
525 vt_add_replace_file 0 "EFI\\hyperiso\\hyperiso.img"
527 elif [ -d (loop)/EFI/BOOT/entries ]; then
528 if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
529 vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
531 elif [ -e (loop)/syslinux/alt0/full.cz ]; then
532 vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
533 set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
540 vt_linux_chain_data ${1}${chosen_path}
542 if [ -n "$vtoy_chain_mem_addr" ]; then
544 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}
547 echo "chain empty failed"
552 function uefi_unix_menu_func {
553 ventoy_unix_comm_proc $1 ${chosen_path}
555 if [ -n "$vtoy_chain_mem_addr" ]; then
557 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}
560 echo "chain empty failed"
565 function uefi_iso_menu_func {
567 if [ -d (loop)/ ]; then
571 if [ -n "$vtisouefi" ]; then
572 set LoadIsoEfiDriver=on
574 elif vt_check_mode 2; then
575 set LoadIsoEfiDriver=on
577 unset LoadIsoEfiDriver
581 vt_select_auto_install ${chosen_path}
582 vt_select_persistence ${chosen_path}
584 if vt_is_udf ${1}${chosen_path}; then
585 set ventoy_fs_probe=udf
587 set ventoy_fs_probe=iso9660
588 vt_iso9660_nojoliet 0
591 loopback loop ${1}${chosen_path}
594 if [ -d (loop)/EFI ]; then
596 elif [ -d (loop)/efi ]; then
602 if [ -n "$vtcompat" ]; then
603 set ventoy_compatible=YES
605 elif vt_check_mode 1; then
606 set ventoy_compatible=YES
608 vt_check_compatible (loop)
611 vt_img_sector ${1}${chosen_path}
613 if [ "$vtoy_os" = "Windows" ]; then
614 vt_check_compatible_pe (loop)
615 uefi_windows_menu_func $1 ${chosen_path}
616 elif [ "$vtoy_os" = "Unix" ]; then
617 uefi_unix_menu_func $1 ${chosen_path}
619 uefi_linux_menu_func $1 ${chosen_path}
625 function uefi_iso_memdisk {
626 echo 'Loading ISO file to memory ...'
627 vt_load_img_memdisk ${1}${2} vtoy_iso_buf
630 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}
637 function legacy_windows_menu_func {
640 if [ "$ventoy_compatible" = "NO" ]; then
642 if [ "$ventoy_fs_probe" = "iso9660" ]; then
644 vt_iso9660_nojoliet 1
648 for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD"; do
649 vt_windows_collect_wim_patch bcd (loop)/$file
652 distro_specify_wim_patch
654 vt_windows_count_wim_patch vt_wim_cnt
655 if [ $vt_wim_cnt -eq 0 ]; then
656 distro_specify_wim_patch_phase2
663 vt_windows_chain_data ${1}${chosen_path}
666 if [ -n "$vtoy_chain_mem_addr" ]; then
667 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
670 echo "chain empty failed"
675 function legacy_linux_menu_func {
676 if [ "$ventoy_compatible" = "NO" ]; then
678 if [ "$ventoy_fs_probe" = "udf" ]; then
680 set ventoy_fs_probe=iso9660
684 vt_load_cpio $vtoy_path/ventoy.cpio $2 $1 "busybox=$ventoy_busybox_ver"
686 vt_linux_clear_initrd
688 if [ -d (loop)/pmagic ]; then
689 vt_linux_specify_initrd_file /pmagic/initrd.img
691 for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
692 if [ -d (loop)/$dir ]; then
693 vt_linux_parse_initrd_isolinux (loop)/$dir/
698 # special process for special distros
700 if [ -d (loop)/arch/boot/syslinux ]; then
701 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
702 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
705 elif [ -d (loop)/manjaro ]; then
706 if [ -e (loop)/boot/grub/kernels.cfg ]; then
707 vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
709 elif [ -e (loop)/boot/grub/grub.cfg ]; then
710 vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
713 distro_specify_initrd_file
715 vt_linux_initrd_count vtcount
716 if [ $vtcount -eq 0 ]; then
717 if [ -d (loop)/rancheros ]; then
718 vt_linux_parse_initrd_isolinux (loop)/boot/ /boot/isolinux/
721 distro_specify_initrd_file_phase2
727 vt_linux_chain_data ${1}${chosen_path}
730 if [ -n "$vtoy_chain_mem_addr" ]; then
731 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
734 echo "chain empty failed"
740 function legacy_unix_menu_func {
741 ventoy_unix_comm_proc $1 ${chosen_path}
743 if [ -n "$vtoy_chain_mem_addr" ]; then
744 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
747 echo "chain empty failed"
753 function legacy_iso_menu_func {
755 if [ -d (loop)/ ]; then
760 vt_select_auto_install ${chosen_path}
761 vt_select_persistence ${chosen_path}
763 if vt_is_udf ${1}${chosen_path}; then
764 set ventoy_fs_probe=udf
766 set ventoy_fs_probe=iso9660
767 vt_iso9660_nojoliet 0
770 loopback loop ${1}${chosen_path}
774 if [ -n "$vtcompat" ]; then
775 set ventoy_compatible=YES
777 elif vt_check_mode 1; then
778 set ventoy_compatible=YES
780 vt_check_compatible (loop)
783 vt_img_sector ${1}${chosen_path}
785 if [ "$vtoy_os" = "Windows" ]; then
786 vt_check_compatible_pe (loop)
787 legacy_windows_menu_func $1 ${chosen_path}
788 elif [ "$vtoy_os" = "Unix" ]; then
789 legacy_unix_menu_func $1 ${chosen_path}
791 legacy_linux_menu_func $1 ${chosen_path}
795 function legacy_iso_memdisk {
797 linux16 $vtoy_path/memdisk iso raw
798 echo "Loading ISO file to memory ..."
804 function iso_endless_os_proc {
805 if [ -d (loop)/ ]; then
809 loopback loop ${1}${2}
810 vt_img_sector ${1}${2}
812 vt_load_cpio $vtoy_path/ventoy.cpio $2 $1 "busybox=$ventoy_busybox_ver"
813 vt_trailer_cpio $1 $2 noinit
817 vt_set_boot_opt '@kparams' rdinit=/vtoy/vtoy
820 set ventoy_bls_bootdev=/boot
821 set ventoy_loading_tip="Loading files ......"
824 configfile (loop)/endless/grub/grub.cfg
827 unset ventoy_bls_bootdev
828 unset ventoy_loading_tip
834 function ventoy_iso_busybox_ver {
835 set ventoy_busybox_ver=32
837 #special process for deepin-live iso
838 if [ "$vt_chosen_size" = "403701760" ]; then
839 if vt_str_str $vt_chosen_path "/deepin-live"; then
840 set ventoy_busybox_ver=64
842 elif vt_str_begin $vt_volume_id "PHOTON_"; then
843 set ventoy_busybox_ver=64
844 elif vt_str_begin $vt_volume_id "smgl-test-quinq-x86_64"; then
845 set ventoy_busybox_ver=64
850 function iso_common_menuentry {
854 vt_chosen_img_path vt_chosen_path vt_chosen_size
855 vt_parse_iso_volume ${vtoy_iso_part}${vt_chosen_path} vt_system_id vt_volume_id
857 ventoy_iso_busybox_ver
859 #special process for Endless OS
860 if vt_str_begin $vt_volume_id "Endless-OS"; then
861 iso_endless_os_proc $vtoy_iso_part $vt_chosen_path
862 elif vt_str_begin $vt_volume_id "TENS-Public"; then
866 if [ "$grub_platform" = "pc" ]; then
867 if vt_check_mode 0; then
868 legacy_iso_memdisk $vtoy_iso_part $vt_chosen_path
870 legacy_iso_menu_func $vtoy_iso_part $vt_chosen_path
873 if vt_check_mode 0; then
874 uefi_iso_memdisk $vtoy_iso_part $vt_chosen_path
876 uefi_iso_menu_func $vtoy_iso_part $vt_chosen_path
881 function miso_common_menuentry {
882 vt_chosen_img_path vt_chosen_path vt_chosen_size
884 echo "memdisk mode boot for $vt_chosen_path"
888 if [ "$grub_platform" = "pc" ]; then
889 legacy_iso_memdisk $vtoy_iso_part $vt_chosen_path
891 uefi_iso_memdisk $vtoy_iso_part $vt_chosen_path
896 function common_unsupport_menuentry {
897 echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
898 echo -e " 文件名中不能有中文或空格 \n"
899 echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
903 function miso_unsupport_menuentry {
904 common_unsupport_menuentry
907 function iso_unsupport_menuentry {
908 common_unsupport_menuentry
911 function wim_common_menuentry {
912 vt_chosen_img_path vt_chosen_path vt_chosen_size
913 vt_wim_chain_data ${vtoy_iso_part}${vt_chosen_path}
917 if [ -n "$vtoy_chain_mem_addr" ]; then
918 if [ "$grub_platform" = "pc" ]; then
919 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
922 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
927 echo "chain empty failed"
932 function wim_unsupport_menuentry {
933 common_unsupport_menuentry
936 function efi_common_menuentry {
937 vt_chosen_img_path vt_chosen_path vt_chosen_size
939 vt_concat_efi_iso ${vtoy_iso_part}${vt_chosen_path} vtoy_iso_buf
945 unset vtoy_dotefi_retry
946 chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} dotefi isoefi=on ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
949 if [ -n "$vtoy_dotefi_retry" ]; then
950 unset vtoy_dotefi_retry
951 chainloader ${vtoy_iso_part}${vt_chosen_path}
958 function efi_unsupport_menuentry {
959 common_unsupport_menuentry
962 function vhd_common_menuentry {
964 if [ "$VTOY_VHD_NO_WARNING" != "1" ]; then
965 if [ "$vtoy_iso_fs" != "ntfs" ]; then
966 echo -e "!!! WARNING !!!\n"
967 echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
968 echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
969 echo -n "press ENTER to continue boot (请按 回车 键继续) ..."
974 vt_chosen_img_path vt_chosen_path vt_chosen_size
975 vt_patch_vhdboot $vt_chosen_path
979 if [ -n "$vtoy_vhd_buf_addr" ]; then
980 if [ "$grub_platform" = "pc" ]; then
981 linux16 $vtoy_path/memdisk iso raw
982 initrd16 mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
986 chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_vhd_buf_addr}:size:${vtoy_vhd_buf_size}
991 echo "Please put the right ventoy_vhdboot.img file to the 1st partition"
996 function vhd_unsupport_menuentry {
997 common_unsupport_menuentry
1000 function vtoyboot_common_func {
1004 vt_get_vtoy_type ${1} vtoytype parttype AltBootPart
1006 if vt_str_begin $vtoytype vhd; then
1008 elif [ "$vtoytype" = "raw" ]; then
1010 elif [ "$vtoytype" = "vdi" ]; then
1014 if [ $vtoysupport -eq 1 ]; then
1015 if [ "$grub_platform" = "pc" ]; then
1016 if [ "$parttype" = "gpt" -a $AltBootPart -eq 0 ]; then
1017 echo "The OS in the vdisk was created in UEFI mode, but current is Legacy BIOS mode."
1018 echo "虚拟磁盘内的系统是在UEFI模式下创建的,而当前系统是Legacy BIOS模式,可能无法正常启动。"
1022 if [ "$parttype" = "mbr" -a $AltBootPart -eq 0 ]; then
1023 echo "The OS in the vdisk was created in Legacy BIOS mode, but current is UEFI mode."
1024 echo "虚拟磁盘内的系统是在Legacy BIOS模式下创建的,而当前系统是UEFI模式,可能无法正常启动。"
1030 vt_raw_chain_data ${1}
1034 if [ -n "$vtoy_chain_mem_addr" ]; then
1035 if [ "$grub_platform" = "pc" ]; then
1036 vt_acpi_param ${vtoy_chain_mem_addr} 512
1037 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1041 chainloader ${vtoy_path}/ventoy_x64.efi sector512 env_param=${ventoy_env_param} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1046 echo "chain empty failed!"
1050 echo "Unsupported vtoy type $vtoytype"
1055 function vtoy_common_menuentry {
1056 vt_chosen_img_path vt_chosen_path vt_chosen_size
1057 vtoyboot_common_func ${vtoy_iso_part}${vt_chosen_path}
1060 function vtoy_unsupport_menuentry {
1061 common_unsupport_menuentry
1065 #============================================================#
1066 # IMG file boot process #
1067 #============================================================#
1071 function ventoy_img_easyos {
1072 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1073 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1075 loopback easysfs (vtimghd,1)/easy.sfs
1076 vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
1078 if [ -n "$vt_module_ver" ]; then
1079 for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
1080 vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
1087 vt_set_boot_opt rdinit=/vtoy/vtoy
1090 syslinux_configfile (vtimghd,1)/syslinux.cfg
1097 function ventoy_img_volumio {
1098 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1099 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1104 vt_set_boot_opt rdinit=/vtoy/vtoy imgpart=/dev/ventoy2 bootpart=/dev/ventoy1
1107 syslinux_configfile (vtimghd,1)/syslinux.cfg
1113 function ventoy_img_openelec {
1116 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1117 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1119 loopback vtloopex $vtoy_efi_part/ventoy/vtloopex.cpio
1120 vt_img_extra_initrd_append (vtloopex)/$elec_ver/vtloopex.tar.xz
1125 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=$elec_ver
1128 set root=(vtimghd,1)
1129 syslinux_configfile (vtimghd,1)/syslinux.cfg
1133 loopback -d vtloopex
1137 function ventoy_img_freedombox {
1138 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1139 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1141 vt_get_lib_module_ver (vtimghd,1) /lib/modules/ vt_module_ver
1142 if [ -n "$vt_module_ver" ]; then
1143 vt_img_extra_initrd_append (vtimghd,1)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
1149 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=freedombox
1152 configfile (vtimghd,1)/boot/grub/grub.cfg
1158 function ventoy_img_paldo {
1159 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1160 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1165 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=paldo
1168 vt_fs_enum_1st_file (vtimghd,1) /loader/entries/ vt_paldo_entry_conf
1169 vt_file_basename $vt_paldo_entry_conf vtPaldoVer
1171 echo loading file...
1172 linux (vtimghd,1)/linux-${vtPaldoVer} root=/dev/ventoy1 rootfstype=vfat
1173 initrd (vtimghd,1)/initramfs-${vtPaldoVer}
1180 function ventoy_img_ubos {
1181 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1182 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1184 vt_get_lib_module_ver (vtimghd,3) /lib/modules/ vt_module_ver
1185 if [ -n "$vt_module_ver" ]; then
1186 vt_img_extra_initrd_append (vtimghd,3)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko.xz
1192 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=ubos
1195 echo loading file...
1196 linux (vtimghd,2)/vmlinuz-linux root=/dev/ventoy3 rw
1197 initrd (vtimghd,2)/initramfs-linux.img
1204 function ventoy_img_recalbox {
1205 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1206 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1211 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=recalbox
1214 set root=(vtimghd,1)
1215 configfile (vtimghd,1)/boot/grub/grub.cfg
1221 function ventoy_img_batocera {
1222 vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
1223 vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
1228 vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=batocera
1231 set root=(vtimghd,1)
1232 syslinux_configfile (vtimghd,1)/boot/syslinux/syslinux.cfg
1238 function ventoy_img_memtest86 {
1239 chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
1243 function img_unsupport_tip {
1244 echo -e "\n This IMG file is NOT supported now. \n"
1245 echo -e " 当前不支持启动此 IMG 文件 \n"
1246 echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
1250 function img_common_menuentry {
1251 set ventoy_compatible=YES
1252 set ventoy_busybox_ver=32
1254 vt_chosen_img_path vt_chosen_path vt_chosen_size
1256 if [ -d (vtimghd)/ ]; then
1260 loopback vtimghd ${vtoy_iso_part}${vt_chosen_path}
1261 vt_img_sector ${vtoy_iso_part}${vt_chosen_path}
1263 vt_img_part_info (vtimghd)
1265 set vtback_root=$root
1269 vt_img_extra_initrd_reset
1271 vt_get_fs_label (vtimghd,1) vtImgHd1Label
1272 if [ -d (vtimghd,2)/lib ]; then
1273 vt_get_fs_label (vtimghd,2) vtImgHd2Label
1276 if [ -e (vtimghd,1)/etc/hostname ]; then
1277 vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
1280 if [ -e (vtimghd,1)/easy.sfs ]; then
1282 elif [ -e (vtimghd,1)/volumio.initrd ]; then
1284 elif vt_str_begin $vtImgHd1Label "LAKKA"; then
1285 ventoy_img_openelec lakka
1286 elif vt_str_begin $vtImgHd1Label "LIBREELEC"; then
1287 ventoy_img_openelec LibreELEC
1288 elif vt_str_begin $vtImgHd1Label "paldo-live"; then
1290 elif vt_str_begin $vtImgHostname "freedombox"; then
1291 ventoy_img_freedombox
1292 elif vt_str_begin $vtImgHd1Label "BATOCERA"; then
1294 elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
1296 elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
1298 elif [ -f (vtimghd,1)/efi/boot/mt86.png ]; then
1299 if [ "$grub_platform" = "pc" ]; then
1302 ventoy_img_memtest86
1305 vt_linux_chain_data ${vtoy_iso_part}${vt_chosen_path}
1306 if [ "$grub_platform" = "pc" ]; then
1307 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1310 chainloader ${vtoy_path}/ventoy_x64.efi sector512 env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
1315 set root=$vtback_root
1318 set ventoy_compatible=NO
1321 function img_unsupport_menuentry {
1322 common_unsupport_menuentry
1325 #############################################################
1326 #############################################################
1327 #############################################################
1328 ####### Main Process ###########
1329 #############################################################
1330 #############################################################
1331 #############################################################
1333 set VENTOY_VERSION="1.0.22"
1335 # Default menu display mode, you can change it as you want.
1338 set VTOY_DEFAULT_MENU_MODE=0
1340 set VTOY_MEM_DISK_STR="[Memdisk]"
1341 set VTOY_ISO_RAW_STR="Compatible Mode"
1342 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
1344 set VTOY_F2_CMD="ventoy_power"
1345 set VTOY_F4_CMD="ventoy_localboot"
1346 set VTOY_F5_CMD="ventoy_diagnosis"
1347 set VTOY_F6_CMD="ventoy_ext_menu"
1349 if [ "$grub_platform" = "pc" ]; then
1350 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
1352 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION UEFI www.ventoy.net"
1355 vt_device $root vtoy_dev
1357 if [ "$vtoy_dev" = "tftp" ]; then
1358 set vtoy_path=($root)
1359 for vtid in 0 1 2 3; do
1360 if [ -f (hd$vtid,2)/ventoy/ventoy.cpio ]; then
1361 set vtoy_iso_part=(hd$vtid,1)
1362 set vtoy_efi_part=(hd$vtid,2)
1369 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
1370 set vt_plugin_path=$vtoy_iso_part
1372 set vt_plugin_path=$prefix
1373 vt_load_plugin $vt_plugin_path
1376 if [ "$prefix" = "(ventoydisk)/grub" ]; then
1377 set vtoy_path=(ventoydisk)/ventoy
1379 set vtoy_path=($root)/ventoy
1382 set vtoydev=$vtoy_dev
1383 set vtoy_iso_part=($vtoy_dev,1)
1384 set vtoy_efi_part=($vtoy_dev,2)
1386 set vt_plugin_path=$vtoy_iso_part
1389 #Load Partition Table
1390 vt_load_part_table $vtoydev
1393 if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then
1394 vt_load_plugin $vtoy_iso_part
1397 if [ -n "$VTOY_MENU_TIMEOUT" ]; then
1398 set timeout=$VTOY_MENU_TIMEOUT
1403 if [ -f $vtoy_iso_part/ventoy/ventoy_wimboot.img ]; then
1404 vt_load_wimboot $vtoy_iso_part/ventoy/ventoy_wimboot.img
1405 elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
1406 vt_load_wimboot $vtoy_efi_part/ventoy/ventoy_wimboot.img
1409 if [ -f $vtoy_iso_part/ventoy/ventoy_vhdboot.img ]; then
1410 vt_load_vhdboot $vtoy_iso_part/ventoy/ventoy_vhdboot.img
1411 elif [ -f $vtoy_efi_part/ventoy/ventoy_vhdboot.img ]; then
1412 vt_load_vhdboot $vtoy_efi_part/ventoy/ventoy_vhdboot.img
1416 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
1417 set VTOY_F3_CMD="vt_dynamic_menu 1 1"
1418 set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Tools F6:ExMenu"
1420 set VTOY_F3_CMD="vt_dynamic_menu 1 0"
1421 set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Tools F6:ExMenu"
1425 if [ -n "$vtoy_gfxmode" ]; then
1426 set gfxmode=$vtoy_gfxmode
1429 set gfxmode=1920x1080,1366x768,1024x768,800x600,auto
1434 if [ "$vtoy_display_mode" = "CLI" ]; then
1435 terminal_output console
1436 elif [ "$vtoy_display_mode" = "serial" ]; then
1437 if [ -n "$vtoy_serial_param" ]; then
1438 serial $vtoy_serial_param
1440 terminal_input serial
1441 terminal_output serial
1442 elif [ "$vtoy_display_mode" = "serial_console" ]; then
1443 if [ -n "$vtoy_serial_param" ]; then
1444 serial $vtoy_serial_param
1446 terminal_input serial console
1447 terminal_output serial console
1449 if [ -n "$vtoy_theme" ]; then
1450 set theme=$vtoy_theme
1452 set theme=$prefix/themes/ventoy/theme.txt
1454 terminal_output gfxterm
1457 #export necessary variable
1463 export vtoy_iso_part
1464 export vtoy_efi_part
1465 export VENTOY_VERSION
1466 export VTOY_CUR_VIDEO_MODE
1469 #colect all image files (iso files)
1470 set ventoy_img_count=0
1471 vt_list_img $vtoy_iso_part ventoy_img_count
1474 if [ $ventoy_img_count -gt 0 ]; then
1475 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
1481 if [ -n "$VTOY_NO_ISO_TIP" ]; then
1482 NO_ISO_MENU="No ISO files found, $VTOY_NO_ISO_TIP"
1483 elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
1484 NO_ISO_MENU="No ISO files found, please check VTOY_DEFAULT_SEARCH_ROOT"
1486 NO_ISO_MENU="No ISO files found"
1488 menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
1489 echo -e "\n Rebooting ... "