Bug#271269: Bug#328424: linux-image-2.6.12-1-k7: does not update grub/menu.lst

Sven Luther sven.luther at wanadoo.fr
Thu Sep 15 18:54:19 UTC 2005


On Thu, Sep 15, 2005 at 12:33:03PM -0600, dann frazier wrote:
> On Thu, 2005-09-15 at 20:10 +0200, Sven Luther wrote:
> > On Thu, Sep 15, 2005 at 11:54:29AM -0600, dann frazier wrote:
> > > On Thu, 2005-09-15 at 11:31 +0200, Peter Eisentraut wrote:
> > > > Am Donnerstag, 15. September 2005 10:41 schrieb Norbert Tretkowski:
> > > > > Have you tried to run 'update-grub' by hand?
> > > > 
> > > > OK, that worked, but it seems the package should do that automatically.
> > > 
> > > The following lines in /etc/kernel-img.conf will make that happen:
> > > 
> > > postinst_hook = /sbin/update-grub
> > > postrm_hook   = /sbin/update-grub
> > > 
> > > d-i should insure that those lines are added if you choose grub as your
> > > bootloader. If you switch to grub later, you need to modify this file by
> > > hand.  This is described in /usr/share/doc/grub/README.Debian.gz.
> > 
> > Maybe the grub package should follow the example of mkvmlinuz, and provide a
> > script in /etc/kernel/post(inst|rm).d/grub
> 
> As long as it is smart enough to know that grub is the active
> bootloader, it sounds like a good idea.  When migrating from LILO, for
> example, you'd want both installed while you configured grub.  Maybe
> provide the mkvmlinuz code as a patch for #271269?
> 

No, the idea is to have the user chose which bootloader he wants to install,
either lilo, grub, grub2, whatever or none-of-the-above.

Each bootloader packages will provide a virtual bootloader package which can
then be depended on by the kernel or something, and will add in their postinst
themselves to the bootloader list, and eventually ask the user which he want
to be the default or something such.

the /etc/kernel/postinst.d script, provided by each bootloader, will check
if they are the default, and if they are install the kernel in it or
something.

The code in it is simply : 

#!/bin/sh

set -e

. /usr/share/debconf/confmodule

db_get mkvmlinuz/bootloaders
bootloader="$RET"

if [ "$bootloader" = mkvmlinuz ]; then
    /usr/sbin/mkvmlinuz $1 $2
fi

Which is rather painless, no ?

And the config script of the mkvmlinuz package has :

#!/bin/sh

set -e

. /usr/share/debconf/confmodule

case $(grep ^machine /proc/cpuinfo) in
    *PReP*Blackhawk*) arch=ppcbug ;;
    *PReP*) arch=prep ;;
    *CHRP*Pegasos*) arch=chrp_pegasos ;;
    *CHRP*) arch=chrp ;;
    *Amiga*) arch=apus ;;
    *iSeries*) arch=iseries ;;
    *)
        case $(grep ^pmac-generation /proc/cpuinfo) in
            *NewWorld) arch=pmac_newworld ;;
            *OldWorld) arch=pmac_oldworld ;;
            *NuBus) arch=pmac_nubus ;;
            *) arch=unknown ;;
        esac
        ;;
esac

# List of bootloader per subarch.
case $arch in
    chrp|pmac_newworld) bootloaders="yaboot, mkvmlinuz" ;;
    pmac_oldworld) bootloaders="quik, mkvmlinuz" ;;
    ppcbug|prep|chrp_pegasos) bootloaders="mkvmlinuz" ;;
    *) bootloaders="unknown" ;;
esac

# If there is more than one bootloader present, ask the user
# at medium priority

db_subst mkvmlinuz/bootloaders choices "$bootloaders"
db_subst mkvmlinuz/bootloaders default "${bootloaders%, *}"
db_input medium mkvmlinuz/bootloaders || true
db_go || true

So, it does some detection, set a list of bootloaders depending on the
subarch, defaults to the first one, and prompts the user at medium priority.

This is a bit different than the proposal above, since we didn't include the
quik and yaboot packages into this logic, but i get you get the idea.

Friendly,

Sven Luther





More information about the Pkg-grub-devel mailing list