Blob Blame History Raw
--- grub-0.97/stage2/builtins.c	2008-09-30 10:24:37.000000000 -0400
+++ grub-0.97/stage2/builtins.c	2008-09-30 10:17:17.000000000 -0400
@@ -76,6 +76,7 @@
 int auth = 0;
 /* The timeout.  */
 int grub_timeout = -1;
+int grub_chaintimeout = -1;
 /* Whether to show the menu or not.  */
 int show_menu = 1;
 /* The BIOS drive map.  */
@@ -531,7 +529,7 @@
 {
   "chainloader",
   chainloader_func,
-  BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+  BUILTIN_CMDLINE | BUILTIN_HELP_LIST | BUILTIN_SHOW_CHAIN_MENU,
   "chainloader [--force] FILE",
   "Load the chain-loader FILE. If --force is specified, then load it"
   " forcibly, whether the boot loader signature is present or not."
@@ -4957,6 +4955,37 @@
 };
 
 
+/* timeout when chainloading */
+static int
+chaintimeout_func (char *arg, int flags)
+{
+  /* One-shot default shenanigans -- don't piss around with the menu! */
+  if (grub_chaintimeout != -1)
+    return 0;
+  if ((saved_entryno & STAGE2_ONCEONLY_ENTRY) != 0)
+    {
+      grub_chaintimeout = 0;
+      return 0;
+    }
+
+  if (! safe_parse_maxint (&arg, &grub_chaintimeout))
+    return 1;
+
+  return 0;
+}
+
+static struct builtin builtin_chaintimeout =
+{
+  "chaintimeout",
+  chaintimeout_func,
+  BUILTIN_MENU,
+#if 0
+  "chaintimeout SEC",
+  "Like timeout builtin, but used when an entry that chainloads is in config"
+#endif
+};
+
+
 /* title */
 static int
 title_func (char *arg, int flags)
@@ -5147,6 +5176,7 @@
 #endif /* SUPPORT_NETBOOT */
   &builtin_cat,
   &builtin_chainloader,
+  &builtin_chaintimeout,
   &builtin_clear,
   &builtin_cmp,
   &builtin_color,
--- grub-0.97/stage2/shared.h	2008-09-30 10:24:37.000000000 -0400
+++ grub-0.97/stage2/shared.h	2008-09-30 10:14:58.000000000 -0400
@@ -837,6 +837,7 @@
 #define BUILTIN_SCRIPT		0x8	/* Run in the script.  */
 #define BUILTIN_NO_ECHO		0x10	/* Don't print command on booting. */
 #define BUILTIN_HELP_LIST	0x20	/* Show help in listing.  */
+#define BUILTIN_SHOW_CHAIN_MENU	0x40	/* Force menu to show up because of chainloading */
 
 /* The table for a builtin.  */
 struct builtin
@@ -872,6 +873,7 @@
 extern kernel_t kernel_type;
 extern int show_menu;
 extern int grub_timeout;
+extern int grub_chaintimeout;
 
 void init_builtins (void);
 void init_config (void);
--- grub-0.97/stage2/stage2.c	2008-09-30 10:24:37.000000000 -0400
+++ grub-0.97/stage2/stage2.c	2008-09-30 10:16:35.000000000 -0400
@@ -1031,7 +1031,13 @@
 		  if (! builtin)
 		    /* Unknown command. Just skip now.  */
 		    continue;
-		  
+
+		  if (builtin->flags & BUILTIN_SHOW_CHAIN_MENU)
+		    {
+		      show_menu = 1;
+		      grub_timeout = grub_chaintimeout;
+		    }
+
 		  if (builtin->flags & BUILTIN_TITLE)
 		    {
 		      char *ptr;
diff -up grub-0.97/stage2/stage2.c.fix-plymouth-patch grub-0.97/stage2/stage2.c
--- grub-0.97/stage2/stage2.c.fix-plymouth-patch	2008-09-30 17:00:18.000000000 -0400
+++ grub-0.97/stage2/stage2.c	2008-09-30 17:00:58.000000000 -0400
@@ -258,14 +258,19 @@ restart:
      interface. */
   if (grub_timeout < 0)
     show_menu = 1;
-  
+
   /* If SHOW_MENU is false, don't display the menu until ESC is pressed.  */
   if (! show_menu)
     {
+      /* Don't show the "Booting in blah seconds message" if the timeout is 0 */
+      int print_message = grub_timeout != 0;
+
       /* Get current time.  */
       while ((time1 = getrtsecs ()) == 0xFF)
 	;
-      grub_verbose_printf("\rPress any key to enter the menu\n\n\n");
+
+      if (print_message)
+	grub_printf("\rPress any key to enter the menu\n\n\n");
 
       while (1)
 	{
@@ -301,9 +306,10 @@ restart:
 	      grub_timeout--;
 	      
 	      /* Print a message.  */
-	      grub_verbose_printf ("\rBooting %s in %d seconds...",
-				   get_entry(menu_entries, first_entry + entryno, 0),
-				   grub_timeout);
+	      if (print_message)
+		grub_printf ("\rBooting %s in %d seconds...",
+		             get_entry(menu_entries, first_entry + entryno, 0),
+		             grub_timeout);
 	    }
 	}
     }