X-Git-Url: https://iankelling.org/git/?p=automated-distro-installer;a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FGRUB_PC%2F10-setup;h=e26aa2671180c03eccc373cac1c9845eef818688;hp=270b356b3f372b3eb8c386c7c3c049b56a7d0fec;hb=591c84435e22df12f2b5121c08578bff7c6bb047;hpb=490334746631a6c956eee47947f3ab8f8a451666 diff --git a/fai/config/scripts/GRUB_PC/10-setup b/fai/config/scripts/GRUB_PC/10-setup index 270b356..e26aa26 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 set -a # do not set up grub during dirinstall @@ -55,6 +56,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 @@ -70,13 +72,15 @@ if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then # remove last , mbrdevices=${mbrdevices%, } else - mbrdevices=$(get_stable_devname $BOOT_DEVICE) + for dev in $BOOT_DEVICE; do + mbrdevices=$(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" + echo "Installing grub on $dev = $mbrdevices" $ROOTCMD grub-install --no-floppy "$mbrdevices" + done fi echo "grub-pc grub-pc/install_devices multiselect $mbrdevices" | $ROOTCMD debconf-set-selections