diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-10-20 23:14:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-11-10 16:00:59 +0100 |
commit | b387778c5b8a1e0d1b3f957f0c5866defbfbe4d4 (patch) | |
tree | bbb0c3d03498ea77a24c298ec4d0439fa61403d4 /src/dissect | |
parent | 9bc4156cdf75dffdb9b5217e353921cd4a7660ae (diff) | |
download | systemd-b387778c5b8a1e0d1b3f957f0c5866defbfbe4d4.tar.gz |
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.
Diffstat (limited to 'src/dissect')
-rw-r--r-- | src/dissect/dissect.c | 4 |
1 files changed, 4 insertions, 0 deletions
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)), |