From b387778c5b8a1e0d1b3f957f0c5866defbfbe4d4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 20 Oct 2022 23:14:28 +0200 Subject: dissect: also parse out the top-level GPT table uuid and expose this as image UUID systemd-repart generates this in a suitably stable fashion, hence let's actually use it as an identifier for the image. As a first step parse it, and show it. --- src/dissect/dissect.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/dissect') diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index 81764690e9..2512cd0f0b 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -594,6 +594,9 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) { else if (arg_json_format_flags & JSON_FORMAT_OFF) { _cleanup_strv_free_ char **sysext_scopes = NULL; + if (!sd_id128_is_null(m->image_uuid)) + printf("Image UUID: %s\n", SD_ID128_TO_UUID_STRING(m->image_uuid)); + if (m->hostname) printf(" Hostname: %s\n", m->hostname); @@ -673,6 +676,7 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) { r = json_build(&v, JSON_BUILD_OBJECT( JSON_BUILD_PAIR("name", JSON_BUILD_STRING(bn)), + JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(m->image_uuid), "imageUuid", JSON_BUILD_UUID(m->image_uuid)), JSON_BUILD_PAIR("size", JSON_BUILD_INTEGER(size)), JSON_BUILD_PAIR_CONDITION(m->hostname, "hostname", JSON_BUILD_STRING(m->hostname)), JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(m->machine_id), "machineId", JSON_BUILD_ID128(m->machine_id)), -- cgit v1.2.1