We're upgrading several systems from Debian Lenny to Squeeze and I'd like to ensure that I haven't missed any grub2 installations. By default, Squeeze chain-boot-loads from grub1 and you have to run upgrade-from-grub-legacy
to upgrade. So I'd like to be able to remotely check to see if grub2 has been installed in the disk boot sector without rebooting, and without overwriting the boot sector.
Is there anything easier than doing a hexdump of the early blocks of the hard drive and trying to identify grub2-specific bytes?
I stumbled onto the answer in the grub2 debian source package. It turns out that it does require a dump of the bootsector - so a separately packaged script might be useful. Here is a script (just a wrapper around the official function) that will tell you whether or not grub2 has been installed into the boot sector. It can be easily modified for similar uses.