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

About other OS boot



Seems that currently grub-installer does not try to add other
installed operating systems to the generated boot menu.

As a temporary measure (until proper installed OS detection is implemented),
the following script may be added. It checks if there is /dev/hda1 that is
not of "Linux" or "Linux swap" type, and if yes, and adds a chainloader option
to gererated /boot/grub/menu.lts in the case.

It seems to be not too bad approach: most users not experienced enough
to modify bootloader configuration after installation have alternate OS
installed on the first partition of the first drive.

if [ -f /target/boot/grub/menu.lst ]; then
  line=`(echo p; echo q) | chroot /target fdisk /dev/hda 2>&1 | grep /dev/hda1`
  if [ -n "$line" ]; then
    if echo $line | grep Linux >/dev/null; then true; else
      # Seems that first partition on first IDE drive exists,
      # and is not Linux and not Linux Swap. So add it to boot menu.
      sed 's/^timeout.*/timeout         15/' < /target/boot/grub/menu.lst > /target/boot/grub/menu.lst.new
      cat >> /target/boot/grub/menu.lst.new << END

title           Old OS at (hd0,0)
root            (hd0,0)
makeactive
chainloader     +1
END
    mv /target/boot/grub/menu.lst.new /target/boot/grub/menu.lst
    fi
  fi
fi



Reply to: