bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug #557] Rotating default boot? Possible feature


From: nobody
Subject: [Bug #557] Rotating default boot? Possible feature
Date: Sun, 16 Jun 2002 18:08:29 -0400

=================== BUG #557: LATEST MODIFICATIONS ==================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=557&group_id=68

Changes by: Anonymous user        Date: 2002-Jun-16 18:08

------------------ Additional Follow-up Comments ----------------------------
--- stage2/builtins.c.ORIG      Sun Jun 16 21:10:05 2002
+++ stage2/builtins.c   Sun Jun 16 23:50:24 2002
@@ -3197,7 +3197,8 @@
 #if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL)
   char buffer[512];
   int *entryno_ptr;
-  
+  int entryno = 0;
+
   /* This command is only useful when you boot an entry from the menu
      interface.  */
   if (! (flags & BUILTIN_SCRIPT))
@@ -3205,6 +3206,12 @@
       errnum = ERR_UNRECOGNIZED;
       return 1;
     }
+
+  /* Get entryno, if specified. Otherwise the current */
+  if (! safe_parse_maxint (&arg, &entryno))
+    {
+      entryno = current_entryno;
+    }
   
   /* Get the geometry of the boot drive (i.e. the disk which contains
      this stage2).  */
@@ -3231,10 +3238,10 @@
   entryno_ptr = (int *) (buffer + STAGE2_SAVED_ENTRYNO);
 
   /* Check if the saved entry number differs from current entry number.  */
-  if (*entryno_ptr != current_entryno)
+  if (*entryno_ptr != entryno)
     {
       /* Overwrite the saved entry number.  */
-      *entryno_ptr = current_entryno;
+      *entryno_ptr = entryno;
       
       /* Save the image in the disk.  */
       if (! rawwrite (boot_drive, install_second_sector, buffer))
@@ -3256,8 +3263,9 @@
   "savedefault",
   savedefault_func,
   BUILTIN_CMDLINE,
-  "savedefault",
-  "Save the current entry as the default boot entry."
+  "savedefault [NUM]",
+  "Save the current entry or the entry number NUM "
+  "as the default boot entry."
 };




=================== BUG #557: FULL BUG SNAPSHOT ===================


Submitted by: None                      Project: grub                           
Submitted on: 2002-Jun-06 20:18
Category:  Configuration                Severity:  Major                        
Priority:  None                         Bug Group:  Feature Request             
Resolution:  None                       Assigned to:  None                      
Status:  Open                           Release:                                
Reproducibility:  None                  Planned Release:                        

Summary:  Rotating default boot? Possible feature

Original Submission:  As operating systems are becoming extremely stable these 
days (even in the MS world), the only times I actually reboot my computer are 
to switch to that /other/ operating system.  When I reboot again, it's to get 
back into my nice Linux environment.

While I do have Linux as default, would it ever be possible to have GRUB rotate 
the default boot between 2 or more partitions?  Then, by default, it would boot 
into a different operating system from what you just restarted in.

Is this a feature that other people would like to see?

Follow-up Comments
*******************

-------------------------------------------------------
Date: 2002-Jun-16 18:08             By: None
--- stage2/builtins.c.ORIG      Sun Jun 16 21:10:05 2002
+++ stage2/builtins.c   Sun Jun 16 23:50:24 2002
@@ -3197,7 +3197,8 @@
 #if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL)
   char buffer[512];
   int *entryno_ptr;
-  
+  int entryno = 0;
+
   /* This command is only useful when you boot an entry from the menu
      interface.  */
   if (! (flags & BUILTIN_SCRIPT))
@@ -3205,6 +3206,12 @@
       errnum = ERR_UNRECOGNIZED;
       return 1;
     }
+
+  /* Get entryno, if specified. Otherwise the current */
+  if (! safe_parse_maxint (&arg, &entryno))
+    {
+      entryno = current_entryno;
+    }
   
   /* Get the geometry of the boot drive (i.e. the disk which contains
      this stage2).  */
@@ -3231,10 +3238,10 @@
   entryno_ptr = (int *) (buffer + STAGE2_SAVED_ENTRYNO);
 
   /* Check if the saved entry number differs from current entry number.  */
-  if (*entryno_ptr != current_entryno)
+  if (*entryno_ptr != entryno)
     {
       /* Overwrite the saved entry number.  */
-      *entryno_ptr = current_entryno;
+      *entryno_ptr = entryno;
       
       /* Save the image in the disk.  */
       if (! rawwrite (boot_drive, install_second_sector, buffer))
@@ -3256,8 +3263,9 @@
   "savedefault",
   savedefault_func,
   BUILTIN_CMDLINE,
-  "savedefault",
-  "Save the current entry as the default boot entry."
+  "savedefault [NUM]",
+  "Save the current entry or the entry number NUM "
+  "as the default boot entry."
 };


-------------------------------------------------------
Date: 2002-Jun-16 18:05             By: None
Can test with this little patch ? It realize the shiva suggestion.

-------------------------------------------------------
Date: 2002-Jun-10 20:45             By: shiva
I think this could be done by accepting a parameter in savedefault: the name of 
the boot section to save as the default for the next boot.

It would also be nice to have a userland utility that sets the default from a 
running OS, so you could create desktop shortcuts to boot a different OS next 
time.




No files currently attached


For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=557&group_id=68



reply via email to

[Prev in Thread] Current Thread [Next in Thread]