From 09ccc4fecf05d5f2594db47200b2a64ed9587cb7 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Sun, 22 Apr 2012 20:06:54 +0200 Subject: [PATCH] rework lvm,raid grub2 support --- usr/share/archboot/installer/setup | 66 +++++++----------------------- 1 file changed, 14 insertions(+), 52 deletions(-) diff --git a/usr/share/archboot/installer/setup b/usr/share/archboot/installer/setup index 570e280bd..3355a1862 100755 --- a/usr/share/archboot/installer/setup +++ b/usr/share/archboot/installer/setup @@ -4006,12 +4006,8 @@ EOF dogrub2_common_before() { ##### Check whether the below limitations still continue with ver 1.99~beta0 ### Grub2 restrictions: - # - dmraid doesn't work: - # https://bugs.launchpad.net/ubuntu/+source/ubuntu-meta/+bug/436340 - # grub2 restriction due to messy dmraid mapping - # - Encryption is not supported by grub2 yet! - # - raid with no supperblock 0.90 is not supported by grub2 yet! - + # - Encryption is not recommended for grub2 /boot! + if [[ -f "${DESTDIR}/boot/grub/menu.lst" ]]; then DIALOG --msgbox "Found ${DESTDIR}/boot/grub/menu.lst, deinstalling grub now ..." 0 0 ${PACMAN} -R grub > ${LOG} @@ -4365,11 +4361,11 @@ dogrub2_bios() { # check if raid, raid partition, dmraid or device devicemapper is used if [[ "$(echo ${bootdev} | grep /dev/md)" ]] || [[ "$(echo ${bootdev} | grep /dev/mapper)" ]]; then - # boot from lvm, raid and dmraid devices is supported + # boot from lvm, raid, partitioned raid and dmraid devices is supported FAIL_COMPLEX="0" - if [[ "$(echo ${bootdev} | grep /dev/md*p)" ]] || [[ "$(cryptsetup status ${bootdev})" ]]; then - # partitionable raid and encryption devices are not supported + if [[ "$(cryptsetup status ${bootdev})" ]]; then + # encryption devices are not supported FAIL_COMPLEX="1" fi fi @@ -4377,31 +4373,6 @@ dogrub2_bios() { if [[ "${FAIL_COMPLEX}" == "0" ]]; then grubdev=$(basename ${bootdev}) complexuuid=$(getfsuuid ${bootdev}) - - # check if mapper is used - if [[ "$(echo ${bootdev} | grep /dev/mapper)" ]]; then - RAID_ON_LVM="0" - - #check if mapper contains a md device! - for devpath in $(pvs -o pv_name --noheading); do - if [[ "$(echo ${devpath} | grep -v /dev/md*p | grep /dev/md)" ]]; then - detectedvolumegroup="$(echo $(pvs -o vg_name --noheading ${devpath}))" - - if [[ "$(echo /dev/mapper/${detectedvolumegroup}-* | grep ${bootdev})" ]]; then - # change bootdev to md device! - bootdev=$(pvs -o pv_name --noheading ${devpath}) - RAID_ON_LVM="1" - break - fi - fi - done - fi - - USE_RAID="" - - if [[ "$(echo ${bootdev} | grep /dev/md)" ]]; then - USE_RAID="1" - fi else # use normal device grubdev=$(mapdev ${bootdev}) @@ -4410,25 +4381,17 @@ dogrub2_bios() { # A switch is needed if complex ${bootdev} is used! - # - It doesn't make sense to present device list, if raid or raid+lvm is used for ${bootdev}. - # - LVM ${bootdev} needs the MBR of a device and cannot be used itself as ${bootdev} + # - LVM and RAID ${bootdev} needs the MBR of a device and cannot be used itself as ${bootdev} if [[ "${FAIL_COMPLEX}" == "0" ]]; then - # use function below if no raid is detected! - if [[ "${RAID_ON_LVM}" == "0" ]]; then - DEVS="$(findbootloaderdisks _)" - - if [[ "${DEVS}" == "" ]]; then - DIALOG --msgbox "No hard drives were found" 0 0 - return 1 - fi - - DIALOG --menu "Select the boot device where the GRUB2 bootloader will be installed." 14 55 7 ${DEVS} 2>${ANSWER} || return 1 - bootdev=$(cat ${ANSWER}) + DEVS="$(findbootloaderdisks _)" + + if [[ "${DEVS}" == "" ]]; then + DIALOG --msgbox "No hard drives were found" 0 0 + return 1 fi - if [[ "${USE_RAID}" == "1" ]]; then - DIALOG --yesno "Setup detected /boot on a raid setup.\n\nContinue installing GRUB2 on ${bootdev}?" 0 0 || return 1 - fi + DIALOG --menu "Select the boot device where the GRUB2 bootloader will be installed." 14 55 7 ${DEVS} 2>${ANSWER} || return 1 + bootdev=$(cat ${ANSWER}) else DEVS="$(findbootloaderdisks _)" DEVS="${DEVS} $(findbootloaderpartitions _)" @@ -4455,7 +4418,7 @@ dogrub2_bios() { fi if [[ "${FAIL_COMPLEX}" == "1" ]]; then - DIALOG --msgbox "Error:\nGrub2 cannot boot from ${bootdev}, which contains /boot!\n\nPossible error sources:\n- raid partition device (/dev/md_dX) are not supported\n- encrypted devices are not supported" 0 0 + DIALOG --msgbox "Error:\nGrub2 cannot boot from ${bootdev}, which contains /boot!\n\nPossible error sources:\n- encrypted devices are not supported" 0 0 return 1 fi @@ -4473,7 +4436,6 @@ dogrub2_bios() { "${bootdev}" &>"/tmp/grub2_bios_install.log" chroot_umount - # cat /tmp/grub2.log > "${LOG}" if [[ -e "${DESTDIR}/boot/grub/i386-pc/core.img" ]]; then DIALOG --msgbox "GRUB2 BIOS has been successfully installed." 0 0