X-Git-Url: https://iankelling.org/git/?p=automated-distro-installer;a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FGRUB_PC%2F10-setup;h=ed8d878ae0395bee09028706c56e9a922fd26510;hp=b23cf36cf243cc2a7ca8a82e75736eb6a50b15f2;hb=HEAD;hpb=723056c40d38694c14d9bcb6b4a3108f7054a2a1 diff --git a/fai/config/scripts/GRUB_PC/10-setup b/fai/config/scripts/GRUB_PC/10-setup index b23cf36..ed8d878 100755 --- a/fai/config/scripts/GRUB_PC/10-setup +++ b/fai/config/scripts/GRUB_PC/10-setup @@ -3,6 +3,7 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code +set -x # do only execute for Debian and similar distros if ! ifclass DEBIAN ; then exit 0 @@ -65,6 +66,7 @@ fi # Check if RAID is used for the boot device if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then + GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE) 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; s/(nvme.+?)p/$1/g; print }' /proc/mdstat); do @@ -80,13 +82,17 @@ if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then # remove last , mbrdevices=${mbrdevices%, } else - mbrdevices=$(get_stable_devname $BOOT_DEVICE) + for dev in $BOOT_DEVICE; do + mbrdev=$(get_stable_devname $dev) if [ -z "$mbrdevices" ]; then - # if we cannot find a persistent name (for e.g. in a VM) use old name - mbrdevices=$BOOT_DEVICE + # if we cannot find a persistent name (for e.g. in a VM) use old name + mbrdevices+="$dev, " fi - echo "Installing grub on $BOOT_DEVICE = $mbrdevices" - $ROOTCMD grub-install --no-floppy "$mbrdevices" + echo "Installing grub on $dev = $mbrdev" + $ROOTCMD grub-install --no-floppy "$mbrdev" + done + # remove trailing , + mbrdevices=${mbrdevices%, } fi echo "grub-pc grub-pc/install_devices multiselect $mbrdevices" | $ROOTCMD debconf-set-selections