Erroneous behaviour when using LVM on LUKS with certain partition layouts

Hi!

I was experiencing erroneous behaviour of the installer (e.g. regarding resulting cryptdevice kernel params in grub config) with my partition layout.

(This is probably related to issue #217 on github)

I was able to track this down to ambiguous usage of lsblk in util-base.sh and util-disk.sh. My partition layout as reported by lsblk is:

NAME                             MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                                8:0    0 931.5G  0 disk  
├─sda1                             8:1    0   512M  0 part  /boot
├─sda2                             8:2    0   600G  0 part  
│ └─manjaro-crypt                254:0    0   600G  0 crypt 
│   ├─manjaro--vg0-manjaro--swap 254:1    0    42G  0 lvm   [SWAP]
│   └─manjaro--vg0-manjaro--root 254:2    0   558G  0 lvm   /
├─sda3                             8:3    0    16M  0 part  
├─sda4                             8:4    0 314.1G  0 part  
└─sda5                             8:5    0    17G  0 part  

Note that the tree structure of sda2's subpartitions (the ones named manjaro-...) contain whitespace due to more partitions following after sda2 (e.g. sda3). Thus, expressions like

lsblk -i | tac | sed -n -e "/\/mnt$/,/part/p" | awk '{print $6}' | grep -q crypt

or

lsblk -i | tac | sed -n -e "/\/mnt$/,/crypt/p" | awk '/crypt/ {print $1}' | sed 's/^..//'

as found in util-base.sh and util-disk.sh won't work as expected, because the actual name of the partition (e.g. manjaro--vg0-manjaro--root) will be field $2 and not $1 due to the whitespace in the tree graph at the beginning of the line.

I have managed to fix this for my case (and hopefully for everyone) by adding a

sed -r 's/^[^[:alnum:]]+//'

to all relevant lsblk lines (i.e. those not using the -l flag and outputting NAME and awk-print'ing or cut'ing a certain field), in order to remove the tree graph characters (thus removing the ambiguousness).

I'll file an according Merge Request afterwards (as soon as I can fork this repo, as I'm having the same issue as described in #249 (closed)).

Edited by Oliver Wegner