Your message dated Sat, 5 May 2007 14:07:37 +0200
with message-id <[EMAIL PROTECTED]>
and subject line update-grub is now customisable
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: grub
Version: 0.92-1
Severity: wishlist
Tags: patch

This patch includes the following changes to update-grub:
1. if present, update-grub invokes /etc/update-grub.helper to generate
kernel entries rather than doing it in update-grub
2. lists the target of the /boot/vmlinuz symlink before everything else
3. replaces /boot with a variable called "bootLinux" and adds a
"bootGrub" variable to hold the path to the boot directory as seen by
GRUB

While this patch allows customization of the entries, it's still far
from optimal since it's not elegant and too difficult for newbies: a
text preprocessor might be a better solution.

I apologize for not splitting the patch; if only some parts of it are
accepted, I'll do the splitting (just mail me).

Sample /etc/update-grub.helper (to be added to /usr/share/doc/grub):
#!/bin/bash

genentry ()
{
        extradesc="$1"
        if test -z "$extradesc" && test "$kern" != "$stdkern"; then
                extradesc=" (locked)"
        fi
        extraopt=""
        if test -n "$2"; then
                extraopt=" $2"
        fi

        echo "title             Debian GNU/Linux, kernel 
$kernelVersion$extradesc"
        if test "$kern" != "$stdkern" || test -n "$2"; then
                echo "lock"
        fi
        echo "root              $groot"
        echo "kernel            $kernel $kopt$extraopt"
        if test -n "$initrd"; then
                echo "initrd            $initrd"
        fi
        echo
}

# I want these right after the standard Debian GNU/Linux entry
output_otheroses()
{
cat <<EOF
title           Another OS not directly supported by GRUB (locked)
lock
root            (hd0,0)
chainloader     +1

title           Boot from Floppy disk (locked)
lock
root            (fd0)
chainloader     +1

EOF
}

case $1 in
entry)
        genentry
        if test "$kern" == "$stdkern"; then
                output_otheroses
        fi
        genentry " (recovery - locked)" single
        ;;
esac




--- /sbin/update-grub   Wed May  1 07:21:53 2002
+++ update-grub Thu May  9 22:28:09 2002
@@ -23,12 +23,21 @@
 #      Marc Haber <[EMAIL PROTECTED]>
 #      Crispin Flowerday <[EMAIL PROTECTED]>
 
+# Export all variables for use by helper script
+set -a
+
 ## StartOPTIONS
+# helper script
+helper="/etc/update-grub.helper"
+
 # name of file menu is stored in
 menufile="menu.lst"
 
+# boot directory as seen from Linux
+bootLinux="/boot"
+
 # directory's to look for the grub installation and the menu file
-grubdirs="/boot/grub /boot/boot/grub"
+grubdirs="$bootLinux/grub $bootLinux$bootLinux/grub"
 
 # Default kernel options, overidden by the kopt statement in the menufile.
 kopt="root=/dev/hda1 ro"
@@ -160,6 +169,19 @@
 # 2.4.14-pre1 > 2.4.13-ac99
 CompareVersions()
 {
+       if test "$1" == "$stdkern"; then
+               if test "$2" == "$stdkern"; then
+                       echo 0
+                       return
+               else
+                       echo 1
+                       return
+               fi
+       elif test "$2" == "$stdkern"; then
+               echo -1
+               return
+       fi
+       
        # First split the version number and remove any '.' 's or dashes
        v1=$(echo $1 | sed -e 's![^0-9]\+! & !g' -e 's![\.\-]!!g')
        v2=$(echo $2 | sed -e 's![^0-9]\+! & !g' -e 's![\.\-]!!g')
@@ -194,6 +216,7 @@
        # finally return the result
        echo $result
 }
+       
 
 # looks in the directory specified for an initrd image with the version 
specified
 FindInitrdName()
@@ -234,6 +257,34 @@
        echo $initrdName
 }
 
+InvokeHelper()
+{
+       if test -n "$helper"; then
+               scripttmp=$(tempfile)
+               $helper script $1 2>&1 >$scripttmp
+               source $scripttmp
+               rm -f $scripttmp
+
+               $helper $1 2>&1 >> $buffer
+               return 0
+       else
+               return 1
+       fi
+}
+
+echo  -n "Searching for helper script ... "
+if test -f "$helper"; then
+       if test -x "$helper"; then
+               echo "found: $helper ."
+       else
+               echo "found, but not using it because it's not executable: 
$helper ."
+               helper=
+       fi
+else
+       echo "not found: it's location is $helper ."
+       helper=
+fi
+
 echo  -n "Searching for GRUB installation directory ... "
 
 for d in $grubdirs ; do
@@ -244,7 +295,7 @@
 done
 
 if [ -z "$dir" ] ; then
-       abort "No GRUB directory found.  To create a template run 'mkdir 
/boot/grub' first.  To install grub, install it manually or try the 
'grub-install' command.  ### Warning, grub-install is used to change your MBR. 
###"
+       abort "No GRUB directory found.  To create a template run 'mkdir 
$bootLinux/grub' first.  To install grub, install it manually or try the 
'grub-install' command.  ### Warning, grub-install is used to change your MBR. 
###"
 else
        echo "found: $dir ."
 fi
@@ -351,8 +402,13 @@
 echo "## ## End Default Options ##" >> $buffer
 echo >> $buffer
 
+stdkern="$(readlink -f $bootLinux/vmlinuz)"
+oldkern="$(readlink -f $bootLinux/vmlinuz.old)"
+
+InvokeHelper prolog
+
 sortedKernels=""
-for kern in $(/bin/ls -1vr /boot/vmlinuz-*) ; do
+for kern in $(/bin/ls -1vr $bootLinux/vmlinuz-*) ; do
        # found a kernel
        newerKernels=""
        for i in $sortedKernels ; do
@@ -380,28 +436,29 @@
        fi
        kernelName=$(basename $kern)
        kernelVersion=$(echo $kernelName | sed -e 's/vmlinuz-//')
-       initrdName=$(FindInitrdName "/boot" "$kernelVersion")
+       initrdName=$(FindInitrdName "$bootLinux" "$kernelVersion")
 
-       if mount | grep -qs "on /boot " > /dev/null 2>&1 ; then
-               kernel=/$kernelName
-               if [ -n "$initrdName" ] ; then
-                       initrd=/$initrdName
-               fi
+       if mount | grep -qs "on $bootLinux " > /dev/null 2>&1 ; then
+               bootGrub=
        else
-               kernel=/boot/$kernelName
-               if [ -n "$initrdName" ] ; then
-                       initrd=/boot/$initrdName
-               fi
+               bootGrub="$bootLinux"
+       fi
+       kernel=$bootGrub/$kernelName
+       initrd=
+       if [ -n "$initrdName" ] ; then  
+               initrd=$bootGrub/$initrdName
        fi
 
-       echo "title             Debian GNU/Linux, kernel $kernelVersion" >> 
$buffer
-       echo "root              $groot" >> $buffer
-       echo "kernel            $kernel $kopt"  >> $buffer
-       if [ -n "$initrdName" ]; then
-               echo "initrd            $initrd" >> $buffer
+       if ! InvokeHelper entry; then
+               echo "title             Debian GNU/Linux, kernel 
$kernelVersion" >> $buffer
+               echo "root              $groot" >> $buffer
+               echo "kernel            $kernel $kopt"  >> $buffer
+               if [ -n "$initrdName" ]; then
+                       echo "initrd            $initrd" >> $buffer
+               fi
+               echo "savedefault" >> $buffer
+               echo >> $buffer
        fi
-       echo "savedefault" >> $buffer
-       echo >> $buffer
 
        # insert the alternative boot options
        if test ! x"$alternative" = x"false" ; then
@@ -409,21 +466,25 @@
                sed -ne 's/# altoptions=\(.*\)/\1/p' $buffer | while read line; 
do
                        descr=$(echo $line | sed -ne 
's/\(([^)]*)\)[[:space:]]\(.*\)/\1/p')
                        suffix=$(echo $line | sed -ne 
's/\(([^)]*)\)[[:space:]]\(.*\)/\2/p')
-                       echo "title             Debian GNU/Linux, kernel 
$kernelVersion $descr" >> $buffer
-                       # lock the alternative options
-                       if test x"$lockalternative" = x"true" ; then
-                               echo "lock" >> $buffer
+                       if ! InvokeHelper entryalt; then
+                               echo "title             Debian GNU/Linux, 
kernel $kernelVersion $descr" >> $buffer
+                               # lock the alternative options
+                               if test x"$lockalternative" = x"true" ; then
+                                       echo "lock" >> $buffer
+                               fi
+                               echo "root              $groot" >> $buffer
+                               echo "kernel            $kernel $kopt $suffix"  
>> $buffer
+                               if [ -n "$initrdName" ]; then
+                                       echo "initrd            $initrd" >> 
$buffer
+                               fi
+                               echo "savedefault" >> $buffer
+                               echo >> $buffer
                        fi
-                       echo "root              $groot" >> $buffer
-                       echo "kernel            $kernel $kopt $suffix"  >> 
$buffer
-                       if [ -n "$initrdName" ]; then
-                               echo "initrd            $initrd" >> $buffer
-                       fi
-                       echo "savedefault" >> $buffer
-                       echo >> $buffer
                done
-       fi
+       fi      
 done
+
+InvokeHelper epilog
 
 echo $end >> $buffer
 

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
update-grub has been completely rewritten for grub2, and is now modular and
extensible.  I think this will address your needs about customisation (if it
doesn't, please file a bug on that package).

-- 
Robert Millan

My spam trap is [EMAIL PROTECTED]  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.

--- End Message ---

Reply via email to