added pygrub grub config
[fai-configs.git] / files / boot / grub / menu.lst / postinst
1 #! /bin/bash
2
3 error=0 ; trap "error=$((error|1))" ERR
4
5 set -a
6
7 if [ -r $LOGDIR/disk_var.sh ] ; then
8 . $LOGDIR/disk_var.sh
9 else
10 echo "disk_var.sh not found!"
11 exit 0
12 fi
13
14 # if class NOMBR is defined, write boot loader into root partition, not into mbr
15 ifclass NOMBR && BOOT_DEVICE=$BOOT_PARTITION
16
17 [ -z "$BOOT_DEVICE" ] && exit 701
18 [ -z "$BOOT_PARTITION" ] && exit 702
19
20 $ROOTCMD grub-install --no-floppy $(device2grub $BOOT_DEVICE)
21 GROOT=$(device2grub $BOOT_PARTITION)
22 perl -pi -e 's/#(\w+)#/$ENV{$1}/g' $2
23 $ROOTCMD /usr/sbin/update-grub
24 echo "Grub installed on $BOOT_DEVICE on $GROOT"
25
26 exit $error
27