Merge branch 'upstream'
[automated-distro-installer] / fai / config / scripts / GRUB_PC / 10-setup
index 88b557ea694876147a48fdfceef7ec3f4f743b40..160dfa2e35fd05333a5b98a895b90e826818aa72 100755 (executable)
@@ -4,6 +4,11 @@
 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 set -a
+
+# do not set up grub during dirinstall
+if [ "$FAI_ACTION" = "dirinstall" ] ; then
+    exit 0
+fi
 # during softupdate use this file
 [ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh
 
@@ -22,6 +27,7 @@ fi
 
 $ROOTCMD grub-mkdevicemap --no-floppy
 
+
 # Check if RAID is used for the boot device
 if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then
     GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE)
@@ -31,6 +37,17 @@ if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then
        echo Install grub on /dev/$device
        $ROOTCMD grub-install --no-floppy "/dev/$device"
     done
+
+elif [[ $GROOT =~ 'hostdisk' ]]; then
+    cat > $target/boot/grub/device.map <<EOF
+(hd0)   $BOOT_DEVICE
+EOF
+    $ROOTCMD grub-install --no-floppy --modules=part_msdos $BOOT_DEVICE
+    if [ $? -eq 0 ]; then
+        echo "Grub installed on hostdisk $BOOT_DEVICE"
+    fi
+    rm $target/boot/grub/device.map
+
 else
     for dev in $BOOT_DEVICE; do
         GROOT=$($ROOTCMD grub-probe -tdrive -d $dev)