int g_ventoy_iso_uefi_drv = 0;
int g_ventoy_last_entry = -1;
int g_ventoy_suppress_esc = 0;
+int g_ventoy_suppress_esc_default = 1;
int g_ventoy_menu_esc = 0;
int g_ventoy_fn_mutex = 0;
int g_ventoy_terminal_output = 0;
default_entry = get_entry_number (menu, "default");
if (g_ventoy_suppress_esc)
- default_entry = 1;
+ default_entry = g_ventoy_suppress_esc_default;
else if (g_ventoy_last_entry >= 0 && g_ventoy_last_entry < menu->size) {
default_entry = g_ventoy_last_entry;
}
break;
}
+ if (autobooted == 0 && g_ventoy_menu_esc && auto_boot) {
+ g_ventoy_last_entry = boot_entry;
+ break;
+ }
+
e = grub_menu_get_entry (menu, boot_entry);
if (! e)
continue; /* Menu is empty. */
{
int i = 0;
int pos = 0;
+ int defidx = 1;
char *buf = NULL;
char configfile[128];
install_template *node = NULL;
if (node->autosel >= 0 && node->autosel <= node->templatenum)
{
- node->cursel = node->autosel - 1;
- debug("Auto install template auto select %d\n", node->autosel);
- return 0;
+ defidx = node->autosel;
+ if (node->timeout < 0)
+ {
+ node->cursel = node->autosel - 1;
+ debug("Auto install template auto select %d\n", node->autosel);
+ return 0;
+ }
}
buf = (char *)grub_malloc(VTOY_MAX_SCRIPT_BUF);
return 0;
}
+ if (node->timeout > 0)
+ {
+ vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout);
+ }
+
vtoy_ssprintf(buf, pos, "menuentry \"Boot without auto installation template\" {\n"
- " echo %s\n}\n", "123");
+ " echo %s\n}\n", "");
for (i = 0; i < node->templatenum; i++)
{
- vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\" {\n"
- " echo 123\n}\n",
+ vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\"{\n"
+ " echo \"\"\n}\n",
node->templatepath[i].path);
}
g_ventoy_menu_esc = 1;
g_ventoy_suppress_esc = 1;
+ g_ventoy_suppress_esc_default = defidx;
grub_snprintf(configfile, sizeof(configfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)buf, pos);
grub_script_execute_sourcecode(configfile);
g_ventoy_menu_esc = 0;
g_ventoy_suppress_esc = 0;
+ g_ventoy_suppress_esc_default = 1;
grub_free(buf);
{
int i = 0;
int pos = 0;
+ int defidx = 1;
char *buf = NULL;
char configfile[128];
persistence_config *node;
if (node->autosel >= 0 && node->autosel <= node->backendnum)
{
- node->cursel = node->autosel - 1;
- debug("Persistence image auto select %d\n", node->autosel);
- return 0;
+ defidx = node->autosel;
+ if (node->timeout < 0)
+ {
+ node->cursel = node->autosel - 1;
+ debug("Persistence image auto select %d\n", node->autosel);
+ return 0;
+ }
}
buf = (char *)grub_malloc(VTOY_MAX_SCRIPT_BUF);
return 0;
}
+ if (node->timeout > 0)
+ {
+ vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout);
+ }
+
vtoy_ssprintf(buf, pos, "menuentry \"Boot without persistence\" {\n"
- " echo %s\n}\n", "123");
+ " echo %s\n}\n", "");
for (i = 0; i < node->backendnum; i++)
{
vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\" {\n"
- " echo 123\n}\n",
+ " echo \"\"\n}\n",
node->backendpath[i].path);
}
g_ventoy_menu_esc = 1;
g_ventoy_suppress_esc = 1;
-
+ g_ventoy_suppress_esc_default = defidx;
+
grub_snprintf(configfile, sizeof(configfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)buf, pos);
grub_script_execute_sourcecode(configfile);
g_ventoy_menu_esc = 0;
g_ventoy_suppress_esc = 0;
+ g_ventoy_suppress_esc_default = 1;
grub_free(buf);
int pathlen;
char isopath[256];
+ int timeout;
int autosel;
int cursel;
int templatenum;
int pathlen;
char isopath[256];
+ int timeout;
int autosel;
int cursel;
int backendnum;
extern int g_ventoy_menu_esc;
extern int g_ventoy_suppress_esc;
+extern int g_ventoy_suppress_esc_default;
extern int g_ventoy_last_entry;
extern int g_ventoy_memdisk_mode;
extern int g_ventoy_iso_raw;
{
int pathnum = 0;
int autosel = 0;
+ int timeout = 0;
char *pos = NULL;
const char *iso = NULL;
VTOY_JSON *pNode = NULL;
grub_printf("autosel: %d [FAIL]\n", autosel);
}
}
+
+ if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "timeout", &timeout))
+ {
+ if (timeout >= 0)
+ {
+ grub_printf("timeout: %d [OK]\n", timeout);
+ }
+ else
+ {
+ grub_printf("timeout: %d [FAIL]\n", timeout);
+ }
+ }
}
else
{
grub_printf("autosel: %d [FAIL]\n", autosel);
}
}
+
+ if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "timeout", &timeout))
+ {
+ if (timeout >= 0)
+ {
+ grub_printf("timeout: %d [OK]\n", timeout);
+ }
+ else
+ {
+ grub_printf("timeout: %d [FAIL]\n", timeout);
+ }
+ }
}
else
{
int type = 0;
int pathnum = 0;
int autosel = 0;
+ int timeout = 0;
const char *iso = NULL;
VTOY_JSON *pNode = NULL;
install_template *node = NULL;
node->templatenum = pathnum;
node->autosel = -1;
+ node->timeout = -1;
if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "autosel", &autosel))
{
if (autosel >= 0 && autosel <= pathnum)
node->autosel = autosel;
}
}
+
+ if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "timeout", &timeout))
+ {
+ if (timeout >= 0)
+ {
+ node->timeout = timeout;
+ }
+ }
if (g_install_template_head)
{
static int ventoy_plugin_persistence_check(VTOY_JSON *json, const char *isodisk)
{
int autosel = 0;
+ int timeout = 0;
int pathnum = 0;
char *pos = NULL;
const char *iso = NULL;
grub_printf("autosel: %d [FAIL]\n", autosel);
}
}
+
+ if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "timeout", &timeout))
+ {
+ if (timeout >= 0)
+ {
+ grub_printf("timeout: %d [OK]\n", timeout);
+ }
+ else
+ {
+ grub_printf("timeout: %d [FAIL]\n", timeout);
+ }
+ }
}
else
{
static int ventoy_plugin_persistence_entry(VTOY_JSON *json, const char *isodisk)
{
int autosel = 0;
+ int timeout = 0;
int pathnum = 0;
const char *iso = NULL;
VTOY_JSON *pNode = NULL;
node->backendnum = pathnum;
node->autosel = -1;
+ node->timeout = -1;
if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "autosel", &autosel))
{
if (autosel >= 0 && autosel <= pathnum)
node->autosel = autosel;
}
}
+
+ if (JSON_SUCCESS == vtoy_json_get_int(pNode->pstChild, "timeout", &timeout))
+ {
+ if (timeout >= 0)
+ {
+ node->timeout = timeout;
+ }
+ }
if (g_persistence_head)
{
g_ventoy_menu_esc = 1;
g_ventoy_suppress_esc = 1;
+ g_ventoy_suppress_esc_default = 1;
grub_snprintf(configfile, sizeof(configfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)buf, size);
grub_script_execute_sourcecode(configfile);