also sprach Otavio Salvador <[EMAIL PROTECTED]> [2006.06.03.1950 +0200]:
> If you can, check the patch and submit it. I'm with a new upload
> almost ready and want to do it asap.

Attached is the debdiff which I have thoroughly tested.

-- 
Please do not send copies of list mail to me; I read the list!
 
 .''`.     martin f. krafft <[EMAIL PROTECTED]>
: :'  :    proud Debian developer and author: http://debiansystem.info
`. `'`
  `-  Debian - when you have better things to do than fixing a system
diff -u grub-0.97/debian/update-grub.8 grub-0.97/debian/update-grub.8
--- grub-0.97/debian/update-grub.8
+++ grub-0.97/debian/update-grub.8
@@ -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
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-9.2) unstable; urgency=low
+
+  * Implemented the "lockold" feature, which allows older kernel stanzas to be
+    automatically locked (pasword-protected). My work is based on a patch by
+    Dominic Hargreaves (closes: Bug#120125).
+
+ -- martin f. krafft <[EMAIL PROTECTED]>  Sun,  4 Jun 2006 15:51:43 +0200
+
 grub (0.97-9.1) unstable; urgency=low
 
   * NMU.
@@ -1269,2 +1276,0 @@
-
-# vim:ai:et:sts=4:sw=4:tw=78:
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
@@ -322,6 +322,9 @@
 # alternatives
        defoptions=""
 
+# should grub lock the old kernels
+       lockold="false"
+
 # options to use with the alternative boot options
        altoptions="(recovery mode) single"
 
@@ -578,15 +581,16 @@
 
 write_kernel_entry()
 {
-       kernel_version=$1
-       recovery_desc=$2
-       lock_alternative=$3
-       grub_root_device=$4
-       kernel=$5
-       kernel_options=$6
-       recovery_suffix=$7
-       initrd=$8
-       savedefault=$9
+       local kernel_version; kernel_version=$1; shift
+       local recovery_desc; recovery_desc=$1; shift
+       local lock_alternative; lock_alternative=$1; shift
+       local grub_root_device; grub_root_device=$1; shift
+       local kernel; kernel=$1; shift
+       local kernel_options; kernel_options=$1; shift
+       local recovery_suffix; recovery_suffix=$1; shift
+       local initrd; initrd=$1; shift
+       local savedefault; savedefault=$1; shift
+  local lockold; lockold=$1; shift
 
        echo -n "title          $title" >> $buffer
        if [ -n "$kernel_version" ]; then
@@ -601,6 +605,10 @@
        if test x"$lock_alternative" = x"true" ; then
                echo "lock" >> $buffer
        fi
+       # lock the old entries
+       if test x"$lockold" = x"true" ; then
+       echo "lock" >> $buffer
+       fi
 
        echo "root              $grub_root_device" >> $buffer
        echo -n "kernel         $kernel"  >> $buffer
@@ -687,6 +695,9 @@
 # Extract the additional default options
 defoptions=$(GetMenuOpt "defoptions" "$defoptions")
 
+# Extract the lockold value
+lockold=$(GetMenuOpt "lockold" "$lockold")
+
 # Extract the howmany value
 howmany=$(GetMenuOpt "howmany" "$howmany")
 
@@ -746,6 +757,12 @@
 echo "# defoptions=$defoptions" >> $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
@@ -914,8 +931,12 @@
        
        currentOpt=$(get_kernel_opt $kernelVersion)
 
+  do_lockold=$lockold
+  # do not lockold for the first entry
+  [ $counter -eq 1 ] && do_lockold=false
+
        write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel" 
\
-       "$currentOpt $defoptions" "" "$initrd" "true"
+    "$currentOpt $defoptions" "" "$initrd" "true" "$do_lockold"
 
        # insert the alternative boot options
        if test ! x"$alternative" = x"false" ; then
@@ -924,9 +945,10 @@
                        descr=$(echo $line | sed -ne 
's/\(([^)]*)\)[[:space:]]\(.*\)/\1/p')
                        suffix=$(echo $line | sed -ne 
's/\(([^)]*)\)[[:space:]]\(.*\)/\2/p')
 
+      test x"$lockalternative" = x"true" && do_lockold=false
                        write_kernel_entry "$kernelVersion" "$descr" 
"$lockalternative" \
-                       "$grub_root_device" "$kernel" "$currentOpt" "$suffix" 
"$initrd" \
-                       "true"
+        "$grub_root_device" "$kernel" "$currentOpt" "$suffix" "$initrd" \
+        "true" "$do_lockold"
 
                done
        fi

Attachment: signature.asc
Description: Digital signature (GPG/PGP)

Reply via email to