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.
if [ "$UID" -ne "0" ]; then
echo Must be run as root
if ! dd if="$1" bs=512 count=1 2>/dev/null | grep -aq GRUB; then
# No version of GRUB is installed.
echo Grub could not be found
# The GRUB boot sector always starts with a JMP instruction.
initial_jmp="$(dd if="$1" bs=2 count=1 2>/dev/null | od -Ax -tx1 | \
head -n1 | cut -d' ' -f2,3)"
[ "$initial_jmp" ] || return 1
[ "$initial_jmp_opcode" = eb ] || return 1
case $initial_jmp_operand in
# I believe this covers all versions of GRUB 2 up to the package
# version where we gained a more explicit mechanism. GRUB Legacy
# always had 48 here.
if scan_grub2 "/dev/sda"; then
echo Found grub 2
echo Did not find grub 2
#Uncomment the next line to upgrade