Bug#120125: Patch for "lockold" feature
Dominic Hargreaves
Dominic Hargreaves <dom@earth.li>, 120125@bugs.debian.org
Fri, 18 Feb 2005 13:04:23 +0000
--Bn2rw/3z4jIqBvZU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Attached is a patch against 0.95+cvs20040624-14 to implement this
feature. Please consider it for inclusion into the official package.
Cheers,
--
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)
--Bn2rw/3z4jIqBvZU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grub-lockold.patch"
diff -urN grub-0.95+cvs20040624/debian/update-grub grub-0.95+cvs20040624.patched/debian/update-grub
--- grub-0.95+cvs20040624/debian/update-grub 2005-02-18 12:27:05.000000000 +0000
+++ grub-0.95+cvs20040624.patched/debian/update-grub 2005-02-18 12:51:15.000000000 +0000
@@ -291,6 +291,9 @@
# should grub lock the alternative boot options in the menu
lockalternative="false"
+# should grub lock the old kernels
+ lockold="false"
+
# options to use with the alternative boot options
altoptions="(recovery mode) single"
@@ -556,6 +559,7 @@
kernel_options=$6
recovery_suffix=$7
initrd=$8
+ lock_old=$9
echo "title Debian GNU/Linux, kernel $kernel_version $recovery_desc" >> $buffer
@@ -563,6 +567,10 @@
if test x"$lock_alternative" = x"true" ; then
echo "lock" >> $buffer
fi
+ # lock the old entries
+ if test x"$lock_old" = x"true" ; then
+ echo "lock" >> $buffer
+ fi
echo "root $grub_root_device" >> $buffer
echo "kernel $kernel $kernel_options $recovery_suffix" >> $buffer
@@ -631,6 +639,9 @@
# Extract the lockalternative value
lockalternative=$(GetMenuOpt "lockalternative" "$lockalternative")
+# Extract the lockold value
+lockold=$(GetMenuOpt "lockold" "$lockold")
+
# Extract the howmany value
howmany=$(GetMenuOpt "howmany" "$howmany")
@@ -675,6 +686,12 @@
echo "# lockalternative=$lockalternative" >> $buffer
echo >> $buffer
+echo "## should update-grub lock old automagic boot options" >> $buffer
+echo "## e.g. lockold=false" >> $buffer
+echo "## lockold=true" >> $buffer
+echo "# lockold=$lockold" >> $buffer
+echo >> $buffer
+
echo "## altoption boot targets option" >> $buffer
echo "## multiple altoptions lines are allowed" >> $buffer
echo "## e.g. altoptions=(extra menu suffix) extra boot options" >> $buffer
@@ -789,8 +806,13 @@
currentOpt=$(get_kernel_opt $kernelVersion)
- write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel" \
- "$currentOpt" "" "$initrd"
+ if [ $counter -gt 1 ] ; then
+ write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel" \
+ "$currentOpt" "" "$initrd" "$lockold"
+ else
+ write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel" \
+ "$currentOpt" "" "$initrd" ""
+ fi
# insert the alternative boot options
if test ! x"$alternative" = x"false" ; then
@@ -800,7 +822,8 @@
suffix=$(echo $line | sed -ne 's/\(([^)]*)\)[[:space:]]\(.*\)/\2/p')
write_kernel_entry "$kernelVersion" "$descr" "$lockalternative" \
- "$grub_root_device" "$kernel" "$currentOpt" "$suffix" "$initrd"
+ "$grub_root_device" "$kernel" "$currentOpt" "$suffix" "$initrd" \
+ ""
done
fi
@@ -819,7 +842,7 @@
echo "Found kernel: $kernel"
write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" \
- "$kernel" "$currentOpt" "" "$initrd"
+ "$kernel" "$currentOpt" "" "$initrd" "$lockold"
fi
done
fi
diff -urN grub-0.95+cvs20040624/debian/update-grub.8 grub-0.95+cvs20040624.patched/debian/update-grub.8
--- grub-0.95+cvs20040624/debian/update-grub.8 2005-02-18 12:27:05.000000000 +0000
+++ grub-0.95+cvs20040624.patched/debian/update-grub.8 2005-02-18 13:01:53.000000000 +0000
@@ -51,6 +51,12 @@
.br
# lockalternative=false
+This option controls if grub should lock the old kernels.
+.br
+# lockold=true
+.br
+# lockold=false
+
This options controls what is used for the alternative boot options, multiple altoptions lines are allowed.
.br
# altoptions=(some description) some kernel command line options
--Bn2rw/3z4jIqBvZU--