installer: detect LUKS and LVM LVs correctly.

This commit is contained in:
Juan RP 2014-08-29 13:30:38 +02:00
parent 70f268cc29
commit 945dc94fe8
1 changed files with 11 additions and 11 deletions

View File

@ -153,22 +153,14 @@ show_partitions() {
for p in /sys/block/$disk/$disk*; do
if [ -d $p ]; then
part=$(basename $p)
fstype=$(lsblk -nfr /dev/$part|awk '{print $2}')
fstype=$(lsblk -nfr /dev/$part|awk '{print $2}'|head -1)
[ "$fstype" = "iso9660" ] && continue
fssize=$(lsblk -nr /dev/$part|awk '{print $4}')
[ "$fstype" = "crypto_LUKS" ] && continue
fssize=$(lsblk -nr /dev/$part|awk '{print $4}'|head -1)
echo "/dev/$part"
echo "size:${fssize:-unknown};fstype:${fstype:-none}"
fi
done
# LVM
for p in $(ls /dev/mapper 2>/dev/null|grep -v control); do
[ "$p" = "live-rw" ] && continue
[ "$p" = "live-base" ] && continue
fstype=$(lsblk -nfr /dev/$part|awk '{print $2}')
fssize=$(lsblk -nr /dev/mapper/$p|awk '{print $4}')
echo "/dev/mapper/$p"
echo "size:${fssize:-unknown};fstype:${fstype:-none}"
done
# Software raid (md)
for p in $(ls -d /dev/md* 2>/dev/null|grep '[0-9]'); do
if cat /proc/mdstat|grep -qw $(echo $p|sed -e 's|/dev/||g'); then
@ -178,6 +170,14 @@ show_partitions() {
echo "size:${fssize:-unknown};fstype:${fstype:-none}"
fi
done
if [ ! -e /sbin/lvs ]; then
continue
fi
# LVM
lvs --noheadings|while read lvname vgname perms size; do
echo "/dev/mapper/${vgname}-${lvname}"
echo "size:${size};fstype:lvm"
done
done
}