diff -Nru grub-installer-1.128ubuntu2/debian/changelog grub-installer-1.128ubuntu2multiprep1/debian/changelog --- grub-installer-1.128ubuntu2/debian/changelog 2016-01-04 09:06:45.000000000 -0500 +++ grub-installer-1.128ubuntu2multiprep1/debian/changelog 2016-02-26 08:14:04.000000000 -0500 @@ -1,3 +1,10 @@ +grub-installer (1.128ubuntu2multiprep1) UNRELEASED; urgency=medium + + * grub-installer [ppc64el]: support multiple PReP partitions on + component devices of a MD/mdadm device (LP: #) + + -- Mauricio Faria de Oliveira Fri, 26 Feb 2016 10:14:04 -0300 + grub-installer (1.128ubuntu2) xenial; urgency=medium * If grub-installer/choose_bootdev only has one non-manual choice, default diff -Nru grub-installer-1.128ubuntu2/grub-installer grub-installer-1.128ubuntu2multiprep1/grub-installer --- grub-installer-1.128ubuntu2/grub-installer 2016-01-04 09:05:50.000000000 -0500 +++ grub-installer-1.128ubuntu2multiprep1/grub-installer 2016-02-26 08:10:01.000000000 -0500 @@ -503,21 +503,38 @@ # By default, use the first PReP partition found (prep-bootdev). # If available, prefer a PReP partition in the same device (disc_offered). # (the matching works on devices with/without disk-partition separator.) + # On MD/mdadm devices, each component device may have a PReP partition. + + wipe_bootdevs="" wipe_bootdev="$(/usr/lib/grub-installer/prep-bootdev)" for prep_p in $(/usr/lib/grub-installer/prep-bootdev -l); do if [ "${prep_p%[0-9]*}" = "${disc_offered%[0-9]*}" ]; then wipe_bootdev=$prep_p break fi + + if echo $disc_offered | grep -q '/dev/md[0-9]\+'; then + if mdadm --detail --verbose $disc_offered \ + | grep -o '/dev/[sv]d[a-z]\+' \ + | grep "${prep_p%[0-9]*}"; then + wipe_bootdevs="$wipe_bootdevs $prep_p" + fi + fi done unset prep_p - if [ -n "$wipe_bootdev" ]; then - info "Wiping PReP partition $wipe_bootdev" - log-output -t grub-installer dd if=/dev/zero of="$wipe_bootdev" bs=512 count="$(blockdev --getsz "$wipe_bootdev")" - else - info "WARNING: PReP partition not found." + if [ -z "$wipe_bootdevs" ]; then + wipe_bootdevs="$wipe_bootdev" fi + + for wipe_bootdev in $wipe_bootdevs; do + if [ -n "$wipe_bootdev" ]; then + info "Wiping PReP partition $wipe_bootdev" + log-output -t grub-installer dd if=/dev/zero of="$wipe_bootdev" bs=512 count="$(blockdev --getsz "$wipe_bootdev")" + else + info "WARNING: PReP partition not found." + fi + done ;; esac @@ -997,6 +1014,14 @@ # Install grub on each space separated disk in the list bootdevs="$bootdev" + + case $ARCH:$grub_package in + ppc64el/*:grub-ieee1275) + # On MD/mdadm devices, each component device may have a PReP partition. + bootdevs="$wipe_bootdevs" + ;; + esac + for bootdev in $bootdevs; do grub_install_params= if ! is_floppy "$bootdev"; then