2 # support for GRUB version 2
4 error
=0; trap 'error=$(($?>$error?$?:$error))' ERR
# save maximum error code
9 # do not set up grub during dirinstall
10 if [ "$FAI_ACTION" = "dirinstall" ] ; then
13 # during softupdate use this file
14 [ -r $LOGDIR/disk_var.sh
] && .
$LOGDIR/disk_var.sh
16 if [ -z "$BOOT_DEVICE" ]; then
20 # disable os-prober because of #788062
21 ainsl
/etc
/default
/grub
'GRUB_DISABLE_OS_PROBER=true'
23 # skip the rest, if not an initial installation
24 if [ $FAI_ACTION != "install" ]; then
29 GROOT
=$
($ROOTCMD grub-probe
-tdrive -d $BOOT_DEVICE)
32 # Check if RAID is used for the boot device
33 if [[ $BOOT_DEVICE =~
'/dev/md' ]]; then
34 GROOT
=$
($ROOTCMD grub-probe
-tdrive -d $BOOT_DEVICE)
35 raiddev
=${BOOT_DEVICE#/dev/}
36 # install grub on all members of RAID
37 for device
in `LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat`; do
38 echo Install grub on
/dev
/$device
39 $ROOTCMD grub-install
--no-floppy "/dev/$device"
42 elif [[ $GROOT =~
'hostdisk' ]]; then
43 for dev
in $BOOT_DEVICE; do
44 $ROOTCMD grub-install
--no-floppy --modules=part_msdos
$dev
46 echo "Grub installed on hostdisk $BOOT_DEVICE"
50 for dev
in $BOOT_DEVICE; do
51 GROOT
=$
($ROOTCMD grub-probe
-tdrive -d $dev)
52 $ROOTCMD grub-install
--no-floppy "$GROOT"
54 echo "Grub installed on $dev = $GROOT"