X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FGRUB_EFI%2F10-setup;fp=fai%2Fconfig%2Fscripts%2FGRUB_EFI%2F10-setup;h=2e39e2f42b14659b29fbc6d528e9b678d2891953;hb=056eb4e90e13b2d8f7cbb8c3b875f35bf0fa207e;hp=0000000000000000000000000000000000000000;hpb=a6f3eaed0a1eebb5c58853fb9faa8bfbec404de3;p=automated-distro-installer diff --git a/fai/config/scripts/GRUB_EFI/10-setup b/fai/config/scripts/GRUB_EFI/10-setup new file mode 100755 index 0000000..2e39e2f --- /dev/null +++ b/fai/config/scripts/GRUB_EFI/10-setup @@ -0,0 +1,67 @@ +#! /bin/bash +# support for GRUB version 2 + +error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code + +# This script assumes that the disk has a GPT partition table and +# that the extended system partition (ESP) is mounted on /boot/efi. +# When building a disk image, we don't change the NVRAM to point at +# the boot image we made available, because the disk image is likely +# not installed on the current system. As a result, we force +# installation into the removable media paths as well as the standard +# debian path. + +set -a + +# do not set up grub during dirinstall +if [ "$FAI_ACTION" = "dirinstall" ] ; then + exit 0 +fi +# during softupdate use this file +[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh + +if [ -z "$BOOT_DEVICE" ]; then + exit 189 +fi + +# disable os-prober because of #788062 +ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true' + +# skip the rest, if not an initial installation +if [ $FAI_ACTION != "install" ]; then + $ROOTCMD update-grub + exit $error +fi + +$ROOTCMD grub-mkdevicemap --no-floppy +GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE) + + +# Check if RAID is used for the boot device +if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then + raiddev=${BOOT_DEVICE#/dev/} + # install grub on all members of RAID + for device in `LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat`; do + echo Install grub on /dev/$device + $ROOTCMD grub-install --no-floppy --force-extra-removable "/dev/$device" + done + +elif [[ $GROOT =~ 'hostdisk' ]]; then + cat > $target/boot/grub/device.map <