[Fai-commit] r6211 - branches/stable/3.4/bin

Michael Prokop mika at alioth.debian.org
Tue Nov 30 22:40:31 UTC 2010


Author: mika
Date: 2010-11-30 22:40:31 +0000 (Tue, 30 Nov 2010)
New Revision: 6211

Modified:
   branches/stable/3.4/bin/fai-cd
Log:
write MBR when using grub2 (closes: #597479)

Modified: branches/stable/3.4/bin/fai-cd
===================================================================
--- branches/stable/3.4/bin/fai-cd	2010-11-30 22:40:28 UTC (rev 6210)
+++ branches/stable/3.4/bin/fai-cd	2010-11-30 22:40:31 UTC (rev 6211)
@@ -242,6 +242,8 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - -
 mkusb(){
 
+    local device
+
     [ $makeusb -eq 0 ] && return
 
     # TODO: If usbdir is a device (matches /dev/) mount it
@@ -257,7 +259,10 @@
     fi
     echo $isoversion > $usbdir/.FAI-CD-VERSION
 
-    # now make the USB device bootable
+
+    if [ "$grub_version" -eq 1 ]; then
+
+    # now make the USB device bootable (grub1)
     rootpartition=$(find_fai_data)
     usbdev=$(echo $rootpartition | sed -e 's/,[[:digit:]]//')
     echo "Root partition is $rootpartition, device is: $usbdev"
@@ -267,6 +272,14 @@
     else
 	echo "Device could not be detemined. Installing grub will be skipped."
     fi
+
+    elif [ "$grub_version" -eq 2 ]; then
+    # detect device of mounted usb stick, grub2
+    device=$(grub-probe -tdrive $usbdir | perl -ane 'm#(/dev/\w+),# && print "$1\n"')
+    echo "Installing grub2 to $device."
+    # this call seems to remove file and copies them again onto the stick
+    grub-install --no-floppy --root-directory=$usbdir $device
+    fi
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - -
 create_iso() {




More information about the Fai-commit mailing list