clr-boot-manager: add support for non-lvm root encryption

cbm_get_luks_uuid get the uuid of the decrypted root partition when this
is in a LVM partition this mean looking for the device information here:
/sys/block/dm-1/slaves/dm-0/slaves/sdb1/dev
without LVM the path would be this:
/sys/block/dm-1/slaves/sdb1/dev

Signed-off-by: Josue David Hernandez <josue.d.hernandez.gutierrez@intel.com>
This commit is contained in:
Josue David Hernandez
2018-04-27 17:38:52 -05:00
committed by William Douglas
parent b4b86f1a21
commit ef77136fe1
+5 -3
View File
@@ -69,10 +69,12 @@ static char *cbm_get_luks_uuid(const char *part)
const char *value = NULL;
const char *sys = cbm_system_get_sysfs_path();
/* i.e. /sys/block/dm-1/slaves/dm-0/slaves/sdb1/dev */
npath = string_printf("%s/block/%s/slaves/*/slaves/*/dev", sys, part);
/* i.e. /sys/block/dm-1/slaves/dm-0/slaves/sdb1/dev
* or /sys/block/dm-1/slaves/sdb1/dev
*/
npath = string_printf("%s/block/%s/slaves/*{,/slaves/*}/dev", sys, part);
glob(npath, GLOB_DOOFFS, NULL, &glo);
glob(npath, GLOB_DOOFFS | GLOB_BRACE, NULL, &glo);
if (glo.gl_pathc < 1) {
globfree(&glo);