From ef77136fe16f467f8a2c1035fc052e14958df57e Mon Sep 17 00:00:00 2001 From: Josue David Hernandez Date: Fri, 27 Apr 2018 17:38:52 -0500 Subject: [PATCH] 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 --- src/lib/probe.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/probe.c b/src/lib/probe.c index 503cf00..dfb6ef2 100644 --- a/src/lib/probe.c +++ b/src/lib/probe.c @@ -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);