bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with LILO + GRUB problem.


From: Justin Piszcz
Subject: Help with LILO + GRUB problem.
Date: Tue, 01 Jan 2002 11:35:43 -0500

I write ik [install-kernel] script [http://www.ramdown.com/war/ik]: but
I have a little problem.
Basically, these guys are saying if they install lilo, uninstall it,
install grub, uninstall lilo etc etc, it will mess up..
However, as you can see below the bootloader cannot correctly determine
the bootloader.
There argument is if the user has a proper LILO or GRUB, which will it
use.
Is it possible to find out what bootloader booted the system if the user
has both GRUB and LILO installed?
Could you please reccomend how I should find either LILO or GRUB and
make sure the other one isn't the one that was used to boot the system?


Here is what I use (which works, but it is not fullproof):

determine_bootloader()
{
     /sbin/lilo > /dev/null 2>&1
     if [ $? = 0 ]; then
       boot="lilo"
     elif [ $? != 0 ]; then
       boot="grub"
     fi
}

bootloader_check()
{
  if [ -e /etc/lilo.conf ] && [ -e /boot/grub/grub.conf ]; then
    determine_bootloader

    elif [ -e /boot/grub/grub.conf ] && [ ! -e /etc/lilo.conf ]; then
      boot="grub"

    elif [ -e /etc/lilo.conf ] && [ ! -e /boot/grub/grub.conf ]; then
      boot="lilo"
      default=`cat /etc/lilo.conf | grep -v '#' | grep default`

      if [ -z "$default" ]; then
        printf "\033[1;33mERROR: No default entry found in
lilo.conf.\033[0m\n"
        printf "\033[1;33mERROR: Add a default=kernel-x.y.z in the top
of /etc/lilo.conf.\033[0m\n"
        printf "\033[1;33mERROR: Exiting...\033[0m\n"
        exit
      fi

    elif [ ! -e /etc/lilo.conf ] && [ ! -e /boot/grub/grub.conf ]; then
      printf "\033[1;33mERROR: No bootloader could be found on this
system.\033[0m\n"
      printf "\033[1;33mERROR: Exiting...\033[0m\n"
      exit
fi
}


<\malex\> [war]: the only thing i could spot right now is some strings
further in the bootsector, there is a GRUB string, you might search the
whole bootsector for the word GRUB, if it doesnt exist, search for LILO,
if it doesnt exist fail or do something else
<ardya> and if both exist?
<[war]> then you have no idea!
<[war]> which works :(
<FendeR> ...EMAIL
<FendeR> NOW =)
<\malex\> ardya: check for GRUB first, if that exists its prolly grub,
then check for lilo
<ardya> bad assumption
<[war]> \malex\: But you cannot assume.
<[war]> ardya: lol
<\malex\> [war]: right, i didnt say this was a perfect solution, just
possible
<nux> You guys remember the pain of your first Linux install?
Installing slack ware with a stack of 800 floppies, or fighting for
hours with X config files that don't make any sense?  Thems was the
days.
<ardya> if a lilo reinstall doesnt overwrite the GRUB word outta the
MBR, you're fucked
<[war]> nux: I used network, heh.
<\malex\> ardya: true
<\malex\> hmm




reply via email to

[Prev in Thread] Current Thread [Next in Thread]