Initial configuration for FAI (work in progress)
[grml-live.git] / etc / grml / fai / config / files / boot / grub / menu.lst / postinst
diff --git a/etc/grml/fai/config/files/boot/grub/menu.lst/postinst b/etc/grml/fai/config/files/boot/grub/menu.lst/postinst
new file mode 100755 (executable)
index 0000000..c688770
--- /dev/null
@@ -0,0 +1,20 @@
+#! /bin/bash
+
+error=0 ; trap "error=$((error|1))" ERR
+
+set -a
+
+# during softupdate use this file
+[ -r $target/var/log/fai/disk_var.sh ] && . $target/var/log/fai/disk_var.sh
+
+# if class NOMBR is defined, write boot loader into root partition, not into mbr
+ifclass NOMBR && BOOT_DEVICE=$BOOT_PARTITION
+
+grub-install --no-floppy --root-directory=$target $BOOT_DEVICE
+GROOT=$(device2grub $BOOT_PARTITION)
+perl -pi -e 's/#(\w+)#/$ENV{$1}/' $2
+$ROOTCMD /usr/sbin/update-grub
+echo "Grub installed on $BOOT_DEVICE on $GROOT"
+
+exit $error
+