X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FGRUB_PC%2F10-setup;h=cbff2d84b606f876be230e092bcdeaac8d91aa2a;hb=7ade5e2c6113530c5f99cfc95880897fcb479f39;hp=c19d4fa0438cf5b8633afabb4961c62486bc5dba;hpb=2773c14668a490a1254a63541e1ef9fd3377104b;p=automated-distro-installer diff --git a/fai/config/scripts/GRUB_PC/10-setup b/fai/config/scripts/GRUB_PC/10-setup index c19d4fa..cbff2d8 100755 --- a/fai/config/scripts/GRUB_PC/10-setup +++ b/fai/config/scripts/GRUB_PC/10-setup @@ -27,22 +27,20 @@ fi GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE) +# handle /boot in lvm-on-md +_bdev=$(readlink -f $BOOT_DEVICE) +if [ "${_bdev%%-*}" = "/dev/dm" ]; then + BOOT_DEVICE=$( lvs --noheadings -o devices $BOOT_DEVICE | sed -e 's/^*\([^(]*\)(.*$/\1/' ) +fi # 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 + 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 echo Install grub on /dev/$device $ROOTCMD grub-install --no-floppy "/dev/$device" done - -elif [[ $GROOT =~ 'hostdisk' ]]; then - $ROOTCMD grub-install --no-floppy --modules=part_msdos $BOOT_DEVICE - if [ $? -eq 0 ]; then - echo "Grub installed on hostdisk $BOOT_DEVICE" - fi - else $ROOTCMD grub-install --no-floppy "$GROOT" if [ $? -eq 0 ]; then