]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect: show image name separately from filename
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2024 10:48:55 +0000 (11:48 +0100)
committerMike Yuan <me@yhndnzj.com>
Tue, 23 Jan 2024 17:33:48 +0000 (01:33 +0800)
If the image name is different from the filename then show it in the
output, since it's relevant for finding sysext/confext release files.

(Image name is typically the filename without the ".raw" suffix and
similar).

src/dissect/dissect.c

index f6a8161d408168b6737835e7ecb25351374628fb..4e44a237939291851fa0973bf782749641c83e89 100644 (file)
@@ -829,7 +829,7 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
                 pager_open(arg_pager_flags);
 
         if (arg_json_format_flags & JSON_FORMAT_OFF) {
-                printf("      Name: %s%s%s\n",
+                printf(" File Name: %s%s%s\n",
                        ansi_highlight(), bn, ansi_normal());
 
                 printf("      Size: %s\n",
@@ -860,6 +860,9 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
                 return log_error_errno(r, "Failed to acquire image metadata: %m");
         else if (arg_json_format_flags & JSON_FORMAT_OFF) {
 
+                if (m->image_name && !streq(m->image_name, bn))
+                        printf("Image Name: %s\n", m->image_name);
+
                 if (!sd_id128_is_null(m->image_uuid))
                         printf("Image UUID: %s\n", SD_ID128_TO_UUID_STRING(m->image_uuid));