#! /bin/sh

for drive in hda1 hdb1 hdc1 hdd1 hde1 sda1 sdb1 sdc1 sdd1
do
 busybox mount -n -t ext2 /dev/$drive /mnt/hd > /dev/null 2>&1
 if [ $? = "0" ]
  then     
    if [ -d /mnt/hd/boot ] 
    then
      grub-set-default --root-directory=/mnt/hd 0; 
      umount /mnt/hd
      break
    fi
    umount /mnt/hd
 fi
done
