diff --git a/usr/share/archboot/installer/setup b/usr/share/archboot/installer/setup index 3d72010eb..e89d7c049 100755 --- a/usr/share/archboot/installer/setup +++ b/usr/share/archboot/installer/setup @@ -21,6 +21,9 @@ FILE_URL="file:///src/core-$(uname -m)/pkg" MIRRORLIST="/etc/pacman.d/mirrorlist" PACKAGES= +# destination of blockdevices in /sys +block=/sys/block + # partitions PART_ROOT= ROOTFS="" @@ -106,7 +109,6 @@ check_media() { # Get cdroms and removable devices get_media() { - block=/sys/block media=/src SET_MEDIA=0 #unmount media first, we may have leftovers ... @@ -149,7 +151,6 @@ manual_media() { } finddisks() { - block=/sys/block # ide devices for dev in $(ls $block | egrep '^hd'); do if [ "$(cat $block/$dev/device/media)" = "disk" ]; then @@ -191,7 +192,6 @@ finddisks() { # don't check on raid devices! findbootloaderdisks() { - block=/sys/block # ide devices for dev in $(ls $block | egrep '^hd'); do if [ "$(cat $block/$dev/device/media)" = "disk" ]; then @@ -227,12 +227,19 @@ findbootloaderdisks() { } findpartitions() { - block=/sys/block for devpath in $(finddisks); do - disk=$(echo $devpath | sed 's|.*/||') + disk=$(basename $devpath) for part in $(ls $block/$disk | egrep ^$disk); do - # check if not already assembled to a none partitionable raid device, includes also partitionable raid partitions - if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null /dev/null | grep "5")" ]; then + # exclude checks: + #- part of raid device + # $(cat /proc/mdstat 2>/dev/null | grep $part) + #- part of lvm2 device + # $(fstype 2>/dev/null /dev/null | grep "5") + #- extended partition on raid partition device + # $(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk\p##g" 2>/dev/null | grep "5") + if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null /dev/null | grep "5")" -o "$(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk\p##g") 2>/dev/null | grep "5")" ]; then if [ -d $block/$disk/$part ]; then echo "/dev/$part" [ "$1" ] && echo $1 @@ -268,13 +275,20 @@ findpartitions() { fi } -# don't list raid devices! +# don't list raid devices, lvm2 and devicemapper! findbootloaderpartitions() { - block=/sys/block for devpath in $(finddisks); do - disk=$(echo $devpath | sed 's|.*/||') + disk=$(basename $devpath) for part in $(ls $block/$disk | egrep ^$disk); do - # check if not already assembled to a raid device + # exclude checks: + #- part of raid device + # $(cat /proc/mdstat 2>/dev/null | grep $part) + #- part of lvm2 device + # $(fstype 2>/dev/null /dev/null | grep "5") + #- partitionable raid partition + # $(echo $part | grep md_d[0-9]) if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null /dev/null | grep "5")" -o "$(echo $part | grep md_d[0-9])" ]; then if [ -d $block/$disk/$part ]; then echo "/dev/$part" @@ -655,7 +669,7 @@ storage is duplication." 0 0 SPARE_DEVICES="$(cat /tmp/.raid-spare | wc -l)" # generate options for mdadm RAIDOPTIONS="--force --run --level=$LEVEL" - [ "$(echo $RAIDDEVICE | grep /md_d[0-9])" ] && RAIDOPTIONS="$RAIDOPTIONS -a mdp" + [ "$(echo $RAIDDEVICE | grep /md_d[0-9])" ] && RAIDOPTIONS="$RAIDOPTIONS -a mdp" && modprobe md_mod 2>/dev/null ! [ "$RAID_DEVICES" = "0" ] && RAIDOPTIONS="$RAIDOPTIONS --raid-devices=$RAID_DEVICES" ! [ "$SPARE_DEVICES" = "0" ] && RAIDOPTIONS="$RAIDOPTIONS --spare-devices=$SPARE_DEVICES" ! [ "$PARITY" = "" ] && RAIDOPTIONS="$RAIDOPTIONS --layout=$PARITY" @@ -671,7 +685,7 @@ storage is duplication." 0 0 fi # writing raid information to partition table if [ "$(echo $RAIDDEVICE | grep /md_d[0-9])" ]; then - for i in $(sfdisk -l $RAIDDEVICE | grep ^/dev | grep -v Empty | sed -e 's# .*##g'); do + for i in $(sfdisk -l $RAIDDEVICE | grep ^/dev | grep -v Empty | grep -v Extended | sed -e 's# .*##g'); do # get device name k=$(echo $i | sed -e 's#p[0-9]##g') # get partition number of device