File grub-R of Package trustedgrub
Index: TrustedGRUB-1.1.3/stage2/builtins.c
===================================================================
--- TrustedGRUB-1.1.3.orig/stage2/builtins.c
+++ TrustedGRUB-1.1.3/stage2/builtins.c
@@ -787,11 +787,11 @@ static int
default_func (char *arg, int flags)
{
#ifndef SUPPORT_DISKLESS
- if (grub_strcmp (arg, "saved") == 0)
+ if (grub_strcmp (arg, "saved") == 0 || (saved_entryno & 0x4000))
{
- default_entry = saved_entryno;
- return 0;
+ default_entry = saved_entryno & 0x3fff;
}
+ else
#endif /* SUPPORT_DISKLESS */
if (! safe_parse_maxint (&arg, &default_entry))
@@ -812,6 +812,22 @@ static struct builtin builtin_default =
#endif
};
+#ifndef SUPPORT_DISKLESS
+static int savedefault_func (char *arg, int flags);
+void __savedefault_once_reset()
+{
+ if (saved_entryno & 0x4000)
+ {
+ int saved_current_entryno = current_entryno;
+ grub_timeout = 0;
+ current_entryno = default_entry;
+ savedefault_func("\0", BUILTIN_SCRIPT);
+ current_entryno = saved_current_entryno;
+ saved_entryno &= 0x3fff;
+ }
+}
+#endif /* SUPPORT_DISKLESS */
+
#ifdef GRUB_UTIL
/* device */
Index: TrustedGRUB-1.1.3/stage2/stage2.c
===================================================================
--- TrustedGRUB-1.1.3.orig/stage2/stage2.c
+++ TrustedGRUB-1.1.3/stage2/stage2.c
@@ -1217,6 +1217,7 @@ get_line_from_config (char *cmdline, int
return pos;
}
+extern void __savedefault_once_reset();
/* This is the starting function in C. */
void
@@ -1490,7 +1491,9 @@ cmain (void)
}
while (is_preset);
}
-
+#ifndef SUPPORT_DISKLESS
+ __savedefault_once_reset();
+#endif
if (! num_entries)
{
/* If no acceptable config file, goto command-line, starting