@@ -3659,12 +3659,12 @@ static grub_err_t ventoy_cmd_sel_auto_install(grub_extcmd_context_t ctxt, int ar
3659
3659
vtoy_ssprintf (buf , pos , "set timeout=%d\n" , node -> timeout );
3660
3660
}
3661
3661
3662
- vtoy_ssprintf (buf , pos , "menuentry \"Boot without auto installation template\" {\n"
3662
+ vtoy_ssprintf (buf , pos , "menuentry \"Boot without auto installation template\" --class=\"sel_auto_install\" {\n"
3663
3663
" echo %s\n}\n" , "" );
3664
3664
3665
3665
for (i = 0 ; i < node -> templatenum ; i ++ )
3666
3666
{
3667
- vtoy_ssprintf (buf , pos , "menuentry \"Boot with %s\"{\n"
3667
+ vtoy_ssprintf (buf , pos , "menuentry \"Boot with %s\" --class=\"sel_auto_install\" {\n"
3668
3668
" echo \"\"\n}\n" ,
3669
3669
node -> templatepath [i ].path );
3670
3670
}
@@ -3765,12 +3765,12 @@ static grub_err_t ventoy_cmd_sel_persistence(grub_extcmd_context_t ctxt, int arg
3765
3765
vtoy_ssprintf (buf , pos , "set timeout=%d\n" , node -> timeout );
3766
3766
}
3767
3767
3768
- vtoy_ssprintf (buf , pos , "menuentry \"Boot without persistence\" {\n"
3768
+ vtoy_ssprintf (buf , pos , "menuentry \"Boot without persistence\" --class=\"sel_persistence\" {\n"
3769
3769
" echo %s\n}\n" , "" );
3770
3770
3771
3771
for (i = 0 ; i < node -> backendnum ; i ++ )
3772
3772
{
3773
- vtoy_ssprintf (buf , pos , "menuentry \"Boot with %s\" {\n"
3773
+ vtoy_ssprintf (buf , pos , "menuentry \"Boot with %s\" --class=\"sel_persistence\" {\n"
3774
3774
" echo \"\"\n}\n" ,
3775
3775
node -> backendpath [i ].path );
3776
3776
@@ -5958,6 +5958,145 @@ static grub_err_t ventoy_cmd_dump_rsv_page(grub_extcmd_context_t ctxt, int argc,
5958
5958
VENTOY_CMD_RETURN (GRUB_ERR_NONE );
5959
5959
}
5960
5960
5961
+ static grub_err_t ventoy_cmd_need_secondary_menu (grub_extcmd_context_t ctxt , int argc , char * * args )
5962
+ {
5963
+ const char * env = NULL ;
5964
+
5965
+ (void )ctxt ;
5966
+ (void )argc ;
5967
+
5968
+ if (g_ventoy_memdisk_mode || g_ventoy_grub2_mode || g_ventoy_wimboot_mode || g_ventoy_iso_raw )
5969
+ {
5970
+ return 1 ;
5971
+ }
5972
+
5973
+ if (ventoy_check_mode_by_name (args [0 ], "vtmemdisk" ) ||
5974
+ ventoy_check_mode_by_name (args [0 ], "vtgrub2" ) ||
5975
+ ventoy_check_mode_by_name (args [0 ], "vtwimboot" ))
5976
+ {
5977
+ return 1 ;
5978
+ }
5979
+
5980
+ env = grub_env_get ("VTOY_SECONDARY_BOOT_MENU" );
5981
+ if (env && env [0 ] == '0' && env [1 ] == 0 )
5982
+ {
5983
+ return 1 ;
5984
+ }
5985
+
5986
+ return 0 ;
5987
+ }
5988
+
5989
+ static grub_err_t ventoy_cmd_show_secondary_menu (grub_extcmd_context_t ctxt , int argc , char * * args )
5990
+ {
5991
+ int n = 0 ;
5992
+ int pos = 0 ;
5993
+ int len = 0 ;
5994
+ int select = 0 ;
5995
+ int timeout = 0 ;
5996
+ char * cmd = NULL ;
5997
+ const char * env = NULL ;
5998
+ ulonglong fsize = 0 ;
5999
+ char cfgfile [128 ];
6000
+ int seldata [16 ] = {0 };
6001
+
6002
+ (void )ctxt ;
6003
+ (void )argc ;
6004
+
6005
+ len = 8 * VTOY_SIZE_1KB ;
6006
+ cmd = (char * )grub_malloc (len );
6007
+ if (!cmd )
6008
+ {
6009
+ return 1 ;
6010
+ }
6011
+
6012
+ grub_env_unset ("VTOY_CHKSUM_FILE_PATH" );
6013
+
6014
+ env = grub_env_get ("VTOY_SECONDARY_TIMEOUT" );
6015
+ if (env )
6016
+ {
6017
+ timeout = (int )grub_strtol (env , NULL , 10 );
6018
+ }
6019
+
6020
+ if (timeout > 0 )
6021
+ {
6022
+ vtoy_len_ssprintf (cmd , pos , len , "set timeout=%d\n" , timeout );
6023
+ }
6024
+
6025
+ fsize = grub_strtoull (args [2 ], NULL , 10 );
6026
+
6027
+ vtoy_dummy_menuentry (cmd , pos , len , "Boot in normal mode" , "second_normal" ); seldata [n ++ ] = 1 ;
6028
+
6029
+ if (grub_strcmp (args [1 ], "Unix" ) != 0 )
6030
+ {
6031
+ if (grub_strcmp (args [1 ], "Windows" ) == 0 )
6032
+ {
6033
+ vtoy_dummy_menuentry (cmd , pos , len , "Boot in wimboot mode" , "second_wimboot" ); seldata [n ++ ] = 2 ;
6034
+ }
6035
+ else
6036
+ {
6037
+ vtoy_dummy_menuentry (cmd , pos , len , "Boot in grub2 mode" , "second_grub2" ); seldata [n ++ ] = 3 ;
6038
+ }
6039
+
6040
+ if (fsize <= VTOY_SIZE_1GB )
6041
+ {
6042
+ vtoy_dummy_menuentry (cmd , pos , len , "Boot in memdisk mode" , "second_memdisk" ); seldata [n ++ ] = 4 ;
6043
+ }
6044
+ }
6045
+
6046
+ vtoy_dummy_menuentry (cmd , pos , len , "File checksum" , "second_checksum" ); seldata [n ++ ] = 5 ;
6047
+
6048
+ do {
6049
+ g_ventoy_menu_esc = 1 ;
6050
+ g_ventoy_suppress_esc = 1 ;
6051
+ g_ventoy_suppress_esc_default = 0 ;
6052
+ grub_snprintf (cfgfile , sizeof (cfgfile ), "configfile mem:0x%llx:size:%d" , (ulonglong )(ulong )cmd , pos );
6053
+ grub_script_execute_sourcecode (cfgfile );
6054
+ g_ventoy_menu_esc = 0 ;
6055
+ g_ventoy_suppress_esc = 0 ;
6056
+ g_ventoy_suppress_esc_default = 1 ;
6057
+
6058
+ select = seldata [g_ventoy_last_entry ];
6059
+
6060
+ if (select == 2 )
6061
+ {
6062
+ g_ventoy_wimboot_mode = 1 ;
6063
+ }
6064
+ else if (select == 3 )
6065
+ {
6066
+ g_ventoy_grub2_mode = 1 ;
6067
+ }
6068
+ else if (select == 4 )
6069
+ {
6070
+ g_ventoy_memdisk_mode = 1 ;
6071
+ }
6072
+ else if (select == 5 )
6073
+ {
6074
+ grub_env_set ("VTOY_CHKSUM_FILE_PATH" , args [0 ]);
6075
+ grub_script_execute_sourcecode ("configfile $vtoy_efi_part/grub/checksum.cfg" );
6076
+ }
6077
+ }while (select == 5 );
6078
+
6079
+ grub_free (cmd );
6080
+ return 0 ;
6081
+ }
6082
+
6083
+ static grub_err_t ventoy_cmd_fs_ignore_case (grub_extcmd_context_t ctxt , int argc , char * * args )
6084
+ {
6085
+ (void )ctxt ;
6086
+ (void )argc ;
6087
+
6088
+ if (args [0 ][0 ] == '0' )
6089
+ {
6090
+ g_ventoy_case_insensitive = 0 ;
6091
+ }
6092
+ else
6093
+ {
6094
+ g_ventoy_case_insensitive = 1 ;
6095
+ }
6096
+
6097
+ return 0 ;
6098
+ }
6099
+
5961
6100
int ventoy_env_init (void )
5962
6101
{
5963
6102
int i ;
@@ -6158,6 +6297,12 @@ static cmd_para ventoy_cmds[] =
6158
6297
{ "vt_iso_vd_id_begin" , ventoy_cmd_iso_vd_id_begin , 0 , NULL , "" , "" , NULL },
6159
6298
{ "vt_fn_mutex_lock" , ventoy_cmd_fn_mutex_lock , 0 , NULL , "" , "" , NULL },
6160
6299
{ "vt_efi_dump_rsv_page" , ventoy_cmd_dump_rsv_page , 0 , NULL , "" , "" , NULL },
6300
+ { "vt_is_standard_winiso" , ventoy_cmd_is_standard_winiso , 0 , NULL , "" , "" , NULL },
6301
+ { "vt_sel_winpe_wim" , ventoy_cmd_sel_winpe_wim , 0 , NULL , "" , "" , NULL },
6302
+ { "vt_need_secondary_menu" , ventoy_cmd_need_secondary_menu , 0 , NULL , "" , "" , NULL },
6303
+ { "vt_show_secondary_menu" , ventoy_cmd_show_secondary_menu , 0 , NULL , "" , "" , NULL },
6304
+ { "vt_fs_ignore_case" , ventoy_cmd_fs_ignore_case , 0 , NULL , "" , "" , NULL },
6305
+ { "vt_systemd_menu" , ventoy_cmd_linux_systemd_menu , 0 , NULL , "" , "" , NULL },
6161
6306
};
6162
6307
6163
6308
int ventoy_register_all_cmd (void )
0 commit comments