Hello,

On Thu, Sep 25, 2003 at 11:13:07AM +1200, Nick Phillips wrote:
> Notwithstanding any bugs which this might work around, update-grub should
> provide some way to avoid adding 'savedefault' to each menu item.
> 
> It is not always the case that booting a kernel means you want it to be
> booted next time, and it is also not always the case that the selection
> either can or should be made by editing menu.lst (the authors of grub knew
> this, that's why they made savedefault an option that could be optionally
> included into menu entries).
> 
> Please add some means to avoid adding savedefault to the menu entries; I
> need it, and I'm sure I'm not alone.

I just worked out a patch (see attachment) for the version of grub
coming with Debian Sarge which changes update-grub that it includes
'savedefault' only if the option 'default' is set to 'saved'.

Yours
  Micha
--- update-grub 2006-01-30 23:40:23.000000000 +0100
+++ update-grub.patched 2006-01-30 23:40:05.000000000 +0100
@@ -619,6 +619,16 @@
 # Extract the memtest86 value
 memtest86=$(GetMenuOpt "memtest86" "$memtest86")
 
+# Extract the current default value
+default=$(sed -n '/^default[\t ]\+/s/^default[\t ]\+//pi' $menu_file)
+
+# Determine whether to use the savedefault option in kernel sections
+if test "$default" = "saved"; then
+    savedefault="true"
+else
+    savedefault="false"
+fi
+
 # Generate the menu options we want to insert
 buffer=$(tempfile)
 echo $start >> $buffer
@@ -772,7 +782,7 @@
        currentOpt=$(get_kernel_opt $kernelVersion)
 
        write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel" 
\
-       "$currentOpt" "" "$initrd" "true"
+       "$currentOpt" "" "$initrd" "$savedefault"
 
        # insert the alternative boot options
        if test ! x"$alternative" = x"false" ; then
@@ -783,7 +793,7 @@
 
                        write_kernel_entry "$kernelVersion" "$descr" 
"$lockalternative" \
                        "$grub_root_device" "$kernel" "$currentOpt" "$suffix" 
"$initrd" \
-                       "true"
+                       "$savedefault"
 
                done
        fi

Reply via email to