Bug#393079: grub: patch for configurable "savedefault" option

Tormod Volden debian.tormod at gmail.com
Sat Jun 9 23:32:16 UTC 2007


Package: grub
Followup-For: Bug #393079


Here is a patch (debdiff from 0.97-28) which introduces the "savedefault" option.
It is by default "false", which means that the kernel boot entries do not get the
savedefault command added. Since "saved" is not used by default, this is the sane
behaviour.

If the "savedefault" option is set to "true", the normal kernel entries will have the
savedefault command added, like in the old version. This breaks many set-ups.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.21-1-486
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages grub depends on:
ii  libc6                         2.5-10     GNU C Library: Shared libraries
ii  libncurses5                   5.6-3      Shared libraries for terminal hand

grub recommends no packages.

-- no debconf information
-------------- next part --------------
diff -u grub-0.97/debian/update-grub grub-0.97/debian/update-grub
--- grub-0.97/debian/update-grub
+++ grub-0.97/debian/update-grub
@@ -330,6 +330,9 @@
 # should grub create a memtest86 entry
 	memtest86="true"
 
+# should grub add "savedefault" to default boot options
+	savedefault="false"
+
 # stores the command line arguments
 	command_line_arguments=$1
 
@@ -354,7 +357,7 @@
 #
 # You can specify 'saved' instead of a number. In this case, the default entry
 # is the entry saved with the command 'savedefault'.
-# WARNING: If you are using dmraid do not change this entry to 'saved' or your
+# WARNING: If you are using dmraid do not use 'savedefault' or your
 # array will desync and will not let you boot your system.
 default		0
 
@@ -753,6 +756,8 @@
 # Extract the updatedefaultentry option
 updatedefaultentry=$(GetMenuOpt "updatedefaultentry" "$updatedefaultentry")
 
+# Extract the savedefault option
+savedefault=$(GetMenuOpt "savedefault" "$savedefault")
 
 # Generate the menu options we want to insert
 buffer=$(tempfile)
@@ -848,6 +853,11 @@
 echo "# updatedefaultentry=$updatedefaultentry" >> $buffer
 echo >> $buffer
 
+echo "## should update-grub add savedefault to the default options" >> $buffer
+echo "## can be true or false" >> $buffer
+echo "# savedefault=$savedefault" >> $buffer
+echo >> $buffer
+
 echo "## ## End Default Options ##" >> $buffer
 echo >> $buffer
 
@@ -983,7 +993,7 @@
     else
       kernel=/boot/loader
     fi
-    write_kernel_entry "" "" "" "$grub_root_device" "$kernel" "" "" "" "true" ""
+    write_kernel_entry "" "" "" "$grub_root_device" "$kernel" "" "" "" "$savedefault" ""
   ;;
 esac
 
@@ -997,9 +1007,11 @@
 title		Chainload into GRUB 2
 root		$grub_root_device
 kernel		$grub2name
-savedefault
-
 EOF
+	if test x"$savedefault" = x"true" ; then
+		echo "savedefault" >> $buffer
+	fi
+	echo >> $buffer
 fi
     
 
@@ -1036,7 +1048,7 @@
 			echo "Found Xen hypervisor $hypervisorVersion,  kernel: $kernel" >&2
 
 			write_kernel_entry "$kernelVersion" '' '' "$grub_root_device" \
-			  "$kernel" "$currentOpt $xenkopt" '' "$initrd" true '' \
+			  "$kernel" "$currentOpt $xenkopt" '' "$initrd" "$savedefault" '' \
 			  Xen "$hypervisor" "$hypervisorVersion" "$xenhopt"
 	        counter=$(($counter + 1))
 		fi
@@ -1049,7 +1061,7 @@
 			echo "Found Xen hypervisor $hypVersion,  kernel: $kernel" >&2
 
 			write_kernel_entry "$kernelVersion" '' '' "$grub_root_device" \
-			  "$kernel" "$currentOpt $xenkopt" '' "$initrd" true '' \
+			  "$kernel" "$currentOpt $xenkopt" '' "$initrd" "$savedefault" '' \
 			  Xen "$kernel_dir/$hypervisor" "$hypVersion" "$xenhopt"
 	        counter=$(($counter + 1))
 		done
@@ -1102,7 +1114,7 @@
 	[ $counter -eq 1 ] && do_lockold=false
 
 	write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel" \
-		"$currentOpt $defoptions" "" "$initrd" "true" "$do_lockold"
+		"$currentOpt $defoptions" "" "$initrd" "$savedefault" "$do_lockold"
 
 	# insert the alternative boot options
 	if test ! x"$alternative" = x"false" ; then
@@ -1114,7 +1126,7 @@
 			test x"$lockalternative" = x"true" && do_lockold=false
 			write_kernel_entry "$kernelVersion" "$descr" "$lockalternative" \
 				"$grub_root_device" "$kernel" "$currentOpt" "$suffix" "$initrd" \
-				"true" "$do_lockold"
+				"$savedefault" "$do_lockold"
 
 		done
 	fi
diff -u grub-0.97/debian/changelog grub-0.97/debian/changelog
--- grub-0.97/debian/changelog
+++ grub-0.97/debian/changelog
@@ -1,3 +1,11 @@
+grub (0.97-29) unstable; urgency=low
+
+  * Make "savedefault" a configurable parameter (default: false)
+    (Closes: #393079)
+  * Rephrase warning about using savedefault/saved
+
+ -- Tormod Volden <debian.tormod at gmail.com>  Sun, 10 Jun 2007 01:10:19 +0200
+
 grub (0.97-28) unstable; urgency=low
 
   * Remove second /sbin/update-grub warning.  Apparently, it is


More information about the Pkg-grub-devel mailing list