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

[tyndur-devel] [PATCH] updated GRUB2 hd image script



* veraltetes grub-setup mit grub-install ersetzt (grub-setup nur bis grub
1.99)
* grub2 executables variabel gemacht (manche Systeme nutzen grub2-*
anstatt grub-*, kann man nun schoen in der myconf.sh ueberschreiben wenn
man moechte)

Signed-off-by: Stefan Linke <particleflux@xxxxxxxxx>
---
 build/scripts/image_hd_grub2 | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/build/scripts/image_hd_grub2 b/build/scripts/image_hd_grub2
index cddc78b..bff0e62 100755
--- a/build/scripts/image_hd_grub2
+++ b/build/scripts/image_hd_grub2
@@ -39,6 +39,8 @@ ROOT_HD=build/root-hd
 ROOT_LOCAL=build/root-local
 MOUNT=build/mnt
 SUDO=sudo
+GRUB_MKIMAGE=grub-mkimage
+GRUB_INSTALL=grub-install
 
 export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
 
@@ -130,11 +132,6 @@ if [ $NEW -ne 0 ]; then
 EOF
 fi
 
-# Partition unmounten und loopback-Device freigeben
-while fuser -m $MOUNT; do true; done
-$SUDO umount $MOUNT
-rmdir $MOUNT
-
 
 # Grub installieren
 if [ $NEW -ne 0 ]; then
@@ -144,12 +141,25 @@ if [ $NEW -ne 0 ]; then
     fi
 
     mkdir -p build/grub2
-    echo "(img) $LOOP_DEV" > build/grub2/device.map
+    echo "(hd0) $LOOP_DEV" > build/grub2/device.map
 
     cp $LOST_GRUB2_MODULESDIR/boot.img build/grub2/
-    grub-mkimage --directory=$LOST_GRUB2_MODULESDIR -O i386-pc -o build/grub2/core.img ext2 biosdisk part_msdos minicmd
 
-    $SUDO grub-setup -m build/grub2/device.map  -d build/grub2 -r "(img,1)" "(img)"
+    $SUDO $GRUB_INSTALL \
+        --root-directory=$MOUNT \
+        --no-floppy \
+        --grub-mkdevicemap=build/grub2/device.map \
+        --modules="part_msdos biosdisk ext2 minicmd" \
+        $LOOP_DEV
+    if [ $? -ne 0 ]; then
+        rm -f $IMAGE_PATH
+        die "Grub-Installation fehlgeschlagen"
+    fi
 
     $SUDO losetup -d $LOOP_DEV
 fi
+
+# Partition unmounten und loopback-Device freigeben
+while fuser -m $MOUNT; do true; done
+$SUDO umount $MOUNT
+rmdir $MOUNT
-- 
1.8.4.4