]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - INSTALL/grub/grub.cfg
1.0.15 release
[Ventoy.git] / INSTALL / grub / grub.cfg
1 #************************************************************************************
2 # Copyright (c) 2020, longpanda <admin@ventoy.net>
3 #
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.
8 #
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.
13 #
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/>.
16 #
17 #************************************************************************************
18
19 function ventoy_pause {
20 if [ -n "${vtdebug_flag}" ]; then
21 echo "press Enter to continue ......"
22 read vtTmpPause
23 fi
24 }
25
26 function ventoy_debug_pause {
27 if [ -n "${vtdebug_flag}" ]; then
28 echo "press Enter to continue ......"
29 read vtTmpPause
30 fi
31 }
32
33 function ventoy_cli_console {
34 if [ "$grub_platform" = "pc" ]; then
35 #terminal_output vga_text
36 terminal_output console
37 else
38 if [ "$vtoy_display_mode" != "CLI" ]; then
39 terminal_output console
40 fi
41 fi
42 }
43
44 function ventoy_gui_console {
45 if [ "$grub_platform" = "pc" ]; then
46 if [ "$vtoy_display_mode" = "CLI" ]; then
47 terminal_output console
48 else
49 terminal_output gfxterm
50 fi
51 else
52 if [ "$vtoy_display_mode" != "CLI" ]; then
53 terminal_output gfxterm
54 fi
55 fi
56 }
57
58 function ventoy_power {
59 configfile $prefix/power.cfg
60 }
61
62 function ventoy_diagnosis {
63 configfile $prefix/debug.cfg
64 }
65
66 function ventoy_localboot {
67 configfile $prefix/localboot.cfg
68 }
69
70 function get_os_type {
71 set vtoy_os=Linux
72
73 for file in "efi/microsoft/boot/bcd" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com" ; do
74 if vt_file_exist_nocase (loop)/$file; then
75 set vtoy_os=Windows
76 break
77 fi
78 done
79
80 if [ -n "${vtdebug_flag}" ]; then
81 echo ISO is $vtoy_os
82 fi
83 }
84
85 function vt_check_compatible_pe {
86 #Check for PE without external tools
87 if [ -f $1/HBCD_PE.ini ]; then
88 set ventoy_compatible=YES
89 fi
90 }
91
92 function locate_initrd {
93 vt_linux_locate_initrd
94
95 if [ -n "${vtdebug_flag}" ]; then
96 vt_linux_dump_initrd
97 ventoy_debug_pause
98 fi
99 }
100
101 function locate_wim {
102 vt_windows_locate_wim_patch (loop)
103
104 if [ -n "${vtdebug_flag}" ]; then
105 echo '###############################################'
106 vt_dump_wim_patch
107 echo '###############################################'
108 ventoy_debug_pause
109 fi
110 }
111
112 function distro_specify_wim_patch {
113 if [ -d (loop)/h3pe ]; then
114 vt_windows_collect_wim_patch wim /BOOT/H3_10PE.WIM
115 vt_windows_collect_wim_patch wim /BOOT/H3_7PE.WIM
116 vt_windows_collect_wim_patch wim /BOOT/H3_8PE.WIM
117 vt_windows_collect_wim_patch wim /BOOT/H3_81PE.WIM
118 fi
119 }
120
121 function distro_specify_wim_patch_phase2 {
122 if [ -f (loop)/boot/boot.wim ]; then
123 vt_windows_collect_wim_patch wim /boot/boot.wim
124 fi
125 }
126
127
128 function distro_specify_initrd_file {
129 if [ -e (loop)/boot/all.rdz ]; then
130 vt_linux_specify_initrd_file /boot/all.rdz
131 elif [ -e (loop)/boot/xen.gz ]; then
132 if [ -e (loop)/install.img ]; then
133 vt_linux_specify_initrd_file /install.img
134 fi
135 elif [ -d (loop)/casper ]; then
136 if [ -e (loop)/casper/initrd ]; then
137 vt_linux_specify_initrd_file /casper/initrd
138 fi
139 if [ -e (loop)/casper/initrd-oem ]; then
140 vt_linux_specify_initrd_file /casper/initrd-oem
141 fi
142 elif [ -e (loop)/boot/grub/initrd.xz ]; then
143 vt_linux_specify_initrd_file /boot/grub/initrd.xz
144 elif [ -e (loop)/initrd.gz ]; then
145 vt_linux_specify_initrd_file /initrd.gz
146 elif [ -e (loop)/slax/boot/initrfs.img ]; then
147 vt_linux_specify_initrd_file /slax/boot/initrfs.img
148 elif [ -e (loop)/pmagic/initrd.img ]; then
149 vt_linux_specify_initrd_file /pmagic/initrd.img
150 elif [ -e (loop)/boot/initrd.xz ]; then
151 vt_linux_specify_initrd_file /boot/initrd.xz
152 elif [ -f (loop)/boot/initrd ]; then
153 vt_linux_specify_initrd_file /boot/initrd
154 elif [ -f (loop)/boot/x86_64/loader/initrd ]; then
155 vt_linux_specify_initrd_file /boot/x86_64/loader/initrd
156 elif [ -f (loop)/boot/initramfs-x86_64.img ]; then
157 vt_linux_specify_initrd_file /boot/initramfs-x86_64.img
158
159
160 fi
161 }
162
163
164 function distro_specify_initrd_file_phase2 {
165 if [ -f (loop)/boot/initrd.img ]; then
166 vt_linux_specify_initrd_file /boot/initrd.img
167 elif [ -f (loop)/Setup/initrd.gz ]; then
168 vt_linux_specify_initrd_file /Setup/initrd.gz
169 elif [ -f (loop)/isolinux/initramfs ]; then
170 vt_linux_specify_initrd_file /isolinux/initramfs
171 elif [ -f (loop)/boot/iniramfs.igz ]; then
172 vt_linux_specify_initrd_file /boot/iniramfs.igz
173 elif [ -f (loop)/initrd-x86_64 ]; then
174 vt_linux_specify_initrd_file /initrd-x86_64
175 elif [ -f (loop)/live/initrd.img ]; then
176 vt_linux_specify_initrd_file /live/initrd.img
177 elif [ -f (loop)/initrd.img ]; then
178 vt_linux_specify_initrd_file /initrd.img
179 elif [ -f (loop)/sysresccd/boot/x86_64/sysresccd.img ]; then
180 vt_linux_specify_initrd_file /sysresccd/boot/x86_64/sysresccd.img
181 elif [ -f (loop)/CDlinux/initrd ]; then
182 vt_linux_specify_initrd_file /CDlinux/initrd
183
184 fi
185 }
186
187 function uefi_windows_menu_func {
188 vt_windows_reset
189
190 if [ "$ventoy_compatible" = "NO" ]; then
191
192 if [ "$ventoy_fs_probe" = "iso9660" ]; then
193 loopback -d loop
194 vt_iso9660_nojoliet 1
195 loopback loop $1$2
196 fi
197
198 for file in "efi/microsoft/boot/bcd"; do
199 vt_windows_collect_wim_patch bcd (loop)/$file
200 done
201
202 vt_windows_count_wim_patch vt_wim_cnt
203 if [ $vt_wim_cnt -eq 0 ]; then
204 distro_specify_wim_patch_phase2
205 fi
206
207 ventoy_debug_pause
208 locate_wim
209 fi
210
211 vt_windows_chain_data ${1}${chosen_path}
212 ventoy_debug_pause
213
214 if [ -n "$vtoy_chain_mem_addr" ]; then
215 ventoy_cli_console
216 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
217 boot
218 else
219 echo "chain empty failed"
220 ventoy_pause
221 fi
222 }
223
224 function uefi_linux_menu_func {
225 if [ "$ventoy_compatible" = "NO" ]; then
226
227 if [ "$ventoy_fs_probe" = "udf" ]; then
228 loopback -d loop
229 set ventoy_fs_probe=iso9660
230 loopback loop $1$2
231 fi
232
233 vt_load_cpio ${vtoy_path}/ventoy.cpio $2 $1
234
235 vt_linux_clear_initrd
236
237 if [ -d (loop)/pmagic ]; then
238 vt_linux_specify_initrd_file /pmagic/initrd.img
239 else
240 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
241 if [ -e (loop)/$file ]; then
242 vt_linux_parse_initrd_grub file (loop)/$file
243 fi
244 done
245 fi
246
247 # special process for special distros
248 if [ -d (loop)/loader/entries ]; then
249 vt_linux_parse_initrd_grub dir (loop)/loader/entries/
250 elif [ -d (loop)/boot/grub ]; then
251 vt_linux_parse_initrd_grub dir (loop)/boot/grub/
252 fi
253
254 distro_specify_initrd_file
255
256 vt_linux_initrd_count vtcount
257 if [ $vtcount -eq 0 ]; then
258 distro_specify_initrd_file_phase2
259
260 if [ "$vt_efi_dir" = "NO" ]; then
261 if [ -f (loop)/efi.img ]; then
262 vt_add_replace_file 0 "initrd"
263 fi
264 fi
265 fi
266
267 locate_initrd
268
269 if [ -d (loop)/loader/entries ]; then
270 vt_linux_get_main_initrd_index vtindex
271
272 if [ -d (loop)/arch ]; then
273 if [ -f (loop)/arch/boot/x86_64/archiso.img ]; then
274 vt_add_replace_file $vtindex "EFI\\archiso\\archiso.img"
275 elif [ -f (loop)/boot/initramfs_x86_64.img ]; then
276 vt_add_replace_file $vtindex "boot\\initramfs_x86_64.img"
277 fi
278 elif [ -f (loop)/EFI/BOOT/initrd.gz ]; then
279 vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
280 fi
281 elif [ -e (loop)/syslinux/alt0/full.cz ]; then
282 vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
283 set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
284 fi
285
286 fi
287
288 vt_linux_chain_data ${1}${chosen_path}
289
290 if [ -n "$vtoy_chain_mem_addr" ]; then
291 ventoy_cli_console
292 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}
293 boot
294 else
295 echo "chain empty failed"
296 ventoy_pause
297 fi
298 }
299
300
301 function uefi_iso_menu_func {
302
303 if [ -d (loop)/ ]; then
304 loopback -d loop
305 fi
306
307 if [ -n "$vtisouefi" ]; then
308 set LoadIsoEfiDriver=on
309 unset vtisouefi
310 elif vt_check_mode 2; then
311 set LoadIsoEfiDriver=on
312 else
313 unset LoadIsoEfiDriver
314 fi
315
316 vt_chosen_img_path chosen_path
317 vt_select_auto_install ${chosen_path}
318 vt_select_persistence ${chosen_path}
319
320 if vt_is_udf ${1}${chosen_path}; then
321 set ventoy_fs_probe=udf
322 else
323 set ventoy_fs_probe=iso9660
324 vt_iso9660_nojoliet 0
325 fi
326
327 loopback loop ${1}${chosen_path}
328 get_os_type (loop)
329
330 if [ -d (loop)/EFI ]; then
331 set vt_efi_dir=YES
332 elif [ -d (loop)/efi ]; then
333 set vt_efi_dir=YES
334 else
335 set vt_efi_dir=NO
336 fi
337
338 if [ -n "$vtcompat" ]; then
339 set ventoy_compatible=YES
340 unset vtcompat
341 elif vt_check_mode 1; then
342 set ventoy_compatible=YES
343 else
344 vt_check_compatible (loop)
345 fi
346
347 vt_img_sector ${1}${chosen_path}
348
349 if [ "$vtoy_os" = "Windows" ]; then
350 vt_check_compatible_pe (loop)
351 uefi_windows_menu_func $1 ${chosen_path}
352 else
353 uefi_linux_menu_func $1 ${chosen_path}
354 fi
355
356 ventoy_gui_console
357 }
358
359 function uefi_iso_memdisk {
360 vt_chosen_img_path chosen_path
361
362 echo 'Loading ISO file to memory ...'
363 vt_load_iso_to_mem ${1}${chosen_path} vtoy_iso_buf
364
365 ventoy_cli_console
366 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}
367 boot
368
369 ventoy_gui_console
370 }
371
372
373 function legacy_windows_menu_func {
374 vt_windows_reset
375
376 if [ "$ventoy_compatible" = "NO" ]; then
377
378 if [ "$ventoy_fs_probe" = "iso9660" ]; then
379 loopback -d loop
380 vt_iso9660_nojoliet 1
381 loopback loop $1$2
382 fi
383
384 for file in "boot/bcd" "/efi/microsoft/boot/bcd" "SSTR/BCD"; do
385 vt_windows_collect_wim_patch bcd (loop)/$file
386 done
387
388 distro_specify_wim_patch
389
390 vt_windows_count_wim_patch vt_wim_cnt
391 if [ $vt_wim_cnt -eq 0 ]; then
392 distro_specify_wim_patch_phase2
393 fi
394
395 ventoy_debug_pause
396 locate_wim
397 fi
398
399 vt_windows_chain_data ${1}${chosen_path}
400 ventoy_debug_pause
401
402 if [ -n "$vtoy_chain_mem_addr" ]; then
403 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
404 boot
405 else
406 echo "chain empty failed"
407 ventoy_pause
408 fi
409 }
410
411 function legacy_linux_menu_func {
412 if [ "$ventoy_compatible" = "NO" ]; then
413
414 if [ "$ventoy_fs_probe" = "udf" ]; then
415 loopback -d loop
416 set ventoy_fs_probe=iso9660
417 loopback loop $1$2
418 fi
419
420 vt_load_cpio $vtoy_path/ventoy.cpio $2 $1
421
422 vt_linux_clear_initrd
423
424 if [ -d (loop)/pmagic ]; then
425 vt_linux_specify_initrd_file /pmagic/initrd.img
426 else
427 for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
428 if [ -d (loop)/$dir ]; then
429 vt_linux_parse_initrd_isolinux (loop)/$dir/
430 fi
431 done
432 fi
433
434 # special process for special distros
435 #archlinux
436 if [ -d (loop)/arch/boot/syslinux ]; then
437 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
438 vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
439
440 #manjaro
441 elif [ -d (loop)/manjaro ]; then
442 if [ -e (loop)/boot/grub/kernels.cfg ]; then
443 vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
444 fi
445 elif [ -e (loop)/boot/grub/grub.cfg ]; then
446 vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
447 fi
448
449 distro_specify_initrd_file
450
451 vt_linux_initrd_count vtcount
452 if [ $vtcount -eq 0 ]; then
453 distro_specify_initrd_file_phase2
454 fi
455
456 locate_initrd
457 fi
458
459 vt_linux_chain_data ${1}${chosen_path}
460 ventoy_debug_pause
461
462 if [ -n "$vtoy_chain_mem_addr" ]; then
463 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
464 boot
465 else
466 echo "chain empty failed"
467 ventoy_pause
468 fi
469 }
470
471 function legacy_iso_menu_func {
472
473 if [ -d (loop)/ ]; then
474 loopback -d loop
475 fi
476
477 vt_chosen_img_path chosen_path
478 vt_select_auto_install ${chosen_path}
479 vt_select_persistence ${chosen_path}
480
481 if vt_is_udf ${1}${chosen_path}; then
482 set ventoy_fs_probe=udf
483 else
484 set ventoy_fs_probe=iso9660
485 vt_iso9660_nojoliet 0
486 fi
487
488 loopback loop ${1}${chosen_path}
489 get_os_type (loop)
490
491 if [ -n "$vtcompat" ]; then
492 set ventoy_compatible=YES
493 unset vtcompat
494 elif vt_check_mode 1; then
495 set ventoy_compatible=YES
496 else
497 vt_check_compatible (loop)
498 fi
499
500 vt_img_sector ${1}${chosen_path}
501
502 if [ "$vtoy_os" = "Windows" ]; then
503 vt_check_compatible_pe (loop)
504 legacy_windows_menu_func $1 ${chosen_path}
505 else
506 legacy_linux_menu_func $1 ${chosen_path}
507 fi
508 }
509
510 function legacy_iso_memdisk {
511 vt_chosen_img_path chosen_path
512
513 linux16 $vtoy_path/memdisk iso raw
514 echo "Loading ISO file to memory ..."
515 initrd16 ${1}${chosen_path}
516 boot
517 }
518
519 function iso_common_menuentry {
520 if [ "$grub_platform" = "pc" ]; then
521 if vt_check_mode 0; then
522 legacy_iso_memdisk $iso_path
523 else
524 legacy_iso_menu_func $iso_path
525 fi
526 else
527 if vt_check_mode 0; then
528 uefi_iso_memdisk $iso_path
529 else
530 uefi_iso_menu_func $iso_path
531 fi
532 fi
533 }
534
535 function common_unsupport_menuentry {
536 echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
537 echo -e " 文件名中不能有中文或空格 \n"
538 echo -e "\n Will return to main menu after 10 seconds ...\n"
539 sleep 10
540 }
541
542 function iso_unsupport_menuentry {
543 common_unsupport_menuentry
544 }
545
546 function wim_common_menuentry {
547 vt_chosen_img_path chosen_path
548 vt_wim_chain_data ${iso_path}${chosen_path}
549
550 ventoy_debug_pause
551
552 if [ -n "$vtoy_chain_mem_addr" ]; then
553 if [ "$grub_platform" = "pc" ]; then
554 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
555 else
556 ventoy_cli_console
557 chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
558 ventoy_gui_console
559 fi
560 boot
561 else
562 echo "chain empty failed"
563 ventoy_pause
564 fi
565 }
566
567 function wim_unsupport_menuentry {
568 common_unsupport_menuentry
569 }
570
571 function efi_common_menuentry {
572 vt_chosen_img_path chosen_path
573
574 ventoy_cli_console
575 chainloader ${iso_path}${chosen_path}
576 boot
577 ventoy_gui_console
578 }
579
580 function efi_unsupport_menuentry {
581 common_unsupport_menuentry
582 }
583
584
585
586 #############################################################
587 #############################################################
588 #############################################################
589 ####### Main Process ###########
590 #############################################################
591 #############################################################
592 #############################################################
593
594 set VENTOY_VERSION="1.0.15"
595
596 # Default menu display mode, you can change it as you want.
597 # 0: List mode
598 # 1: TreeView mode
599 set VTOY_DEFAULT_MENU_MODE=0
600
601 set VTOY_MEM_DISK_STR="[Memdisk]"
602 set VTOY_ISO_RAW_STR="Compatible Mode"
603 set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
604
605 set VTOY_F2_CMD="ventoy_power"
606 set VTOY_F4_CMD="ventoy_localboot"
607 set VTOY_F5_CMD="ventoy_diagnosis"
608
609 if [ "$grub_platform" = "pc" ]; then
610 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
611 else
612 set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION UEFI www.ventoy.net"
613 fi
614
615 vt_device $root vtoy_dev
616
617 if [ "$vtoy_dev" = "tftp" ]; then
618 set vtoy_path=($root)
619 for vtid in 0 1 2 3; do
620 if [ -d (hd$vtid,2)/ventoy ]; then
621 set iso_path=(hd$vtid,1)
622 set vtoy_efi_part=(hd$vtid,2)
623 break
624 fi
625 done
626 loadfont ascii
627
628 if [ -f $iso_path/ventoy/ventoy.json ]; then
629 set vt_plugin_path=$iso_path
630 else
631 set vt_plugin_path=$prefix
632 vt_load_plugin $vt_plugin_path
633 fi
634 else
635 if [ "$prefix" = "(ventoydisk)/grub" ]; then
636 set vtoy_path=(ventoydisk)/ventoy
637 else
638 set vtoy_path=($root)/ventoy
639 fi
640
641 set iso_path=($vtoy_dev,1)
642 set vtoy_efi_part=($vtoy_dev,2)
643 loadfont unicode
644 set vt_plugin_path=$iso_path
645 fi
646
647
648 #Load Plugin
649 if [ -f $iso_path/ventoy/ventoy.json ]; then
650 vt_load_plugin $iso_path
651 fi
652
653 if [ -n "$VTOY_MENU_TIMEOUT" ]; then
654 set timeout=$VTOY_MENU_TIMEOUT
655 else
656 unset timeout
657 fi
658
659 if [ -f $iso_path/ventoy/ventoy_wimboot.img ]; then
660 vt_load_wimboot $iso_path/ventoy/ventoy_wimboot.img
661 elif [ -f $vtoy_efi_part/ventoy/ventoy_wimboot.img ]; then
662 vt_load_wimboot $vtoy_efi_part/ventoy/ventoy_wimboot.img
663 fi
664
665
666 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
667 set VTOY_F3_CMD="vt_dynamic_menu 1 1"
668 set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView F4:Localboot F5:Debug"
669 else
670 set VTOY_F3_CMD="vt_dynamic_menu 1 0"
671 set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView F4:Localboot F5:Debug"
672 fi
673
674
675 if [ -n "$vtoy_gfxmode" ]; then
676 set gfxmode=$vtoy_gfxmode
677 else
678 set gfxmode=1920x1080,1366x768,1024x768
679 fi
680
681 if [ "$vtoy_display_mode" = "CLI" ]; then
682 terminal_output console
683 else
684 if [ -n "$vtoy_theme" ]; then
685 set theme=$vtoy_theme
686 else
687 set theme=$prefix/themes/ventoy/theme.txt
688 fi
689 terminal_output gfxterm
690 fi
691
692 #colect all image files (iso files)
693 set ventoy_img_count=0
694 vt_list_img $iso_path ventoy_img_count
695
696 #Main menu
697 if [ $ventoy_img_count -gt 0 ]; then
698 if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
699 vt_dynamic_menu 0 0
700 else
701 vt_dynamic_menu 0 1
702 fi
703 else
704 if [ -n "$VTOY_NO_ISO_TIP" ]; then
705 NO_ISO_MENU="No ISO files found, $VTOY_NO_ISO_TIP"
706 elif [ -n "$VTOY_DEFAULT_SEARCH_ROOT" ]; then
707 NO_ISO_MENU="No ISO files found, please check VTOY_DEFAULT_SEARCH_ROOT"
708 else
709 NO_ISO_MENU="No ISO files found"
710 fi
711 menuentry "$NO_ISO_MENU (Press enter to reboot ...)" {
712 echo -e "\n Rebooting ... "
713 reboot
714 }
715 fi