Re: What's the easiest way for a shell script to tell if grub version 1 is installed?



Stephen Powell wrote:
What's the easiest way for a shell script to tell if grub version 1
is installed? It is important to distinguish grub version 1 from
grub version 2. For example, can I just do this?

if [ -f /boot/grub/menu.lst ];then
blah
blah
blah
fi

If you only need to know if the grub2 *package* is installed then a
very quick check is to see if the documentation directory for it is
installed. Since all packages are required by Debian Policy to have a
documentation directory.

if [ -d /usr/share/doc/grub-pc ]; then
echo The Grub2 package is installed.
fi

Or does that file exist in grub version 2 as well?

If the machine was upgraded from version 1 to version 2 then the
menu.lst file will be left behind until manually removed. Because it
facilitates returning to version 1 if required.

But having the package installed doesn't meant that the machine
actually has grub2 installed in the boot path. That seems a little
more difficult.

I recently read this blog entry by Colin Watson that talked a little
bit about grub versions and the problems of mixing them. You might
find it interesting.

http://www.chiark.greenend.org.uk/ucgi/~cjwatson/blosxom/2010/06/21#2010-06-21-grub2-boot-problems

Bob

Attachment: signature.asc
Description: Digital signature



Relevant Pages

  • Re: Whats the easiest way for a shell script to tell if grub version 1 is installed?
    ... It is important to distinguish grub version 1 from ... echo The Grub2 package is installed. ...
    (Debian-User)
  • Re: Control hidden folder/file settings?
    ... > package and the package defaults are fine. ... expensive Crossover Office component that primarily distinguishes ... Deluxe Edition. ... > Even with that, there's always something like [blah, blah, blah] ...
    (comp.os.linux.misc)
  • Re: dual booting computer sheddies to the bridge
    ... My actual file has a comma, the fullstop was just an artifact of my ... Dr. Ivan seems to confirm that a grub reinstall might well pick everything ... Mine has a 'System' submenu which offers a 'KPackage Package Manager'. ...
    (uk.rec.sheds)
  • Re: dual booting computer sheddies to the bridge
    ... My actual file has a comma, the fullstop was just an artifact of my sloppy tryping. ... Dr. Ivan seems to confirm that a grub reinstall might well pick everything ... Mine has a 'System' submenu which offers a 'KPackage Package Manager'. ... installed packages, select it, and look for an 'uninstall' ...
    (uk.rec.sheds)
  • Re: status of LILO in upcoming Stable release
    ... replace a boot loader. ... but that's because they have played games with package names ... this package is the original grub. ... Squeeze also has a package called "grub", but it is not grub version 1. ...
    (Debian-User)