Re: Boot Loader Detection: GRUB or LILO?

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

 



Watchout on this one - I've got a machine here which has had both bootloaders installed, and both GRUB and LILO show up in the MBR - but if you pipe it through strings - like Leonid said - it looks like you will see only see 'lbaLILO' on the machine where it's active. Here's what works for me:

#!/bin/bash
dd ibs=512 count=1 if=/dev/hda 2>&1 | strings | \
	grep GRUB 2>&1 > /dev/null
isgrub=$?
if [ $isgrub -eq 0 ] ; then
    echo "Grub"
else
    dd ibs=512 count=1 if=/dev/hda 2>&1 | strings | \
	grep lbaLILO 2>&1 > /dev/null
    islilo=$?
    if [ $islilo -eq 0 ] ; then
	echo "Lilo"
    else
	echo "Unknown"
    fi
fi



Michael Kearey wrote:
Aaron Konstam wrote:

On Mon, Oct 27, 2003 at 04:07:15PM -0700, Charles Curley wrote:

Is there any way to detect which boot loader is the working one?
Simply detecting whether a grub or lilo package is installed may not
be sufficient, especially in the case where both are installed. I
suppose I could look to see which is more recent, grub.conf or
lilo.conf, but I can think of several scenarios unde which this would
fail.

It's time to update my bare metal recovery scripts
(http://www.charlescurley.com/Linux-Complete-Backup-and-Recovery-HOWTO.html)


to handle grub, and I'd like to detect the current boot loader if
possible.


The solutions suggested seem too complicated. Just reboot. Unless things
have changed radically the lilo boot screen looks completely different
that the grub boot screen.


The original post very obviously needs a way to detect Grub and Lilo programmatically.

The solutions suggested are appropriate. Maybe you need to read the original post carefully.

Cheers,
Michael


-- fedora-list mailing list fedora-list@xxxxxxxxxx http://www.redhat.com/mailman/listinfo/fedora-list

-- e r i k w i l l i a m s o n erik@xxxxxxxxxxxxxxxx system admin . department of computer science . university of calgary




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux