summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2023-03-28 10:36:49 +0100
committerLuca Boccassi <bluca@debian.org>2023-03-28 12:14:21 +0100
commit7d9829521097f9307bef36ba56b5aad243e3d152 (patch)
treefdd9e97eaf60e1f5bc4a49c61875c1e5c01041cd /src/portable
parente8114a4f86efa9a176962bbebbba4cb8b5a1c322 (diff)
downloadsystemd-7d9829521097f9307bef36ba56b5aad243e3d152.tar.gz
portablectl: display sysext-specific fields
The wrong fields were being displayed, if at all. ID and VERSION_ID in sysexts are used for matching, they don't identify the sysext itself. Parse the newly defined fields and display them separately from the compatibility fields. Before: Image: /home/bluca/git/systemd/base.raw Portable Service: n/a Operating System: Debian GNU/Linux 10 (buster) Extension: /home/bluca/git/systemd/app0.raw Extension Scope: n/a Extension Compatibility Level: n/a Portable Service: n/a Portable Prefixes: n/a Operating System: n/a (debian 10) Extension: /home/bluca/git/systemd/app1.raw Extension Scope: n/a Extension Compatibility Level: n/a Portable Service: n/a Portable Prefixes: n/a Operating System: n/a (debian 10) Unit files: app0.service app1.service After: Image: /home/bluca/git/systemd/base.raw Portable Service: n/a Operating System: Debian GNU/Linux 10 (buster) Extension: /home/bluca/git/systemd/app0.raw Extension Scope: n/a Extension Compatibility Level: n/a Extension Compatibility OS: debian Extension Compatibility OS Version: 10 Portable Service: n/a Portable Prefixes: n/a Extension Image: ID: app Version: 0 Extension: /home/bluca/git/systemd/app1.raw Extension Scope: n/a Extension Compatibility Level: n/a Extension Compatibility OS: debian Extension Compatibility OS Version: 10 Portable Service: n/a Portable Prefixes: n/a Extension Image: ID: app Version: 1 Unit files: app0.service app1.service
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/portablectl.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c
index d390a9295d..d463eb4120 100644
--- a/src/portable/portablectl.c
+++ b/src/portable/portablectl.c
@@ -400,7 +400,8 @@ static int inspect_image(int argc, char *argv[], void *userdata) {
nl = true;
} else {
_cleanup_free_ char *pretty_portable = NULL, *pretty_os = NULL, *sysext_level = NULL,
- *id = NULL, *version_id = NULL, *sysext_scope = NULL, *portable_prefixes = NULL;
+ *sysext_id = NULL, *sysext_version_id = NULL, *sysext_scope = NULL, *portable_prefixes = NULL,
+ *id = NULL, *version_id = NULL, *image_id = NULL, *image_version = NULL, *build_id = NULL;
_cleanup_fclose_ FILE *f = NULL;
f = fmemopen_unlocked((void*) data, sz, "r");
@@ -408,30 +409,42 @@ static int inspect_image(int argc, char *argv[], void *userdata) {
return log_error_errno(errno, "Failed to open extension-release buffer: %m");
r = parse_env_file(f, name,
- "ID", &id,
- "VERSION_ID", &version_id,
+ "SYSEXT_ID", &sysext_id,
+ "SYSEXT_VERSION_ID", &sysext_version_id,
+ "SYSEXT_BUILD_ID", &build_id,
+ "SYSEXT_IMAGE_ID", &image_id,
+ "SYSEXT_IMAGE_VERSION", &image_version,
+ "SYSEXT_PRETTY_NAME", &pretty_os,
"SYSEXT_SCOPE", &sysext_scope,
"SYSEXT_LEVEL", &sysext_level,
+ "ID", &id,
+ "VERSION_ID", &version_id,
"PORTABLE_PRETTY_NAME", &pretty_portable,
- "PORTABLE_PREFIXES", &portable_prefixes,
- "PRETTY_NAME", &pretty_os);
+ "PORTABLE_PREFIXES", &portable_prefixes);
if (r < 0)
return log_error_errno(r, "Failed to parse extension release from '%s': %m", name);
printf("Extension:\n\t%s\n"
"\tExtension Scope:\n\t\t%s\n"
"\tExtension Compatibility Level:\n\t\t%s\n"
+ "\tExtension Compatibility OS:\n\t\t%s\n"
+ "\tExtension Compatibility OS Version:\n\t\t%s\n"
"\tPortable Service:\n\t\t%s\n"
"\tPortable Prefixes:\n\t\t%s\n"
- "\tOperating System:\n\t\t%s (%s %s)\n",
+ "\tExtension Image:\n\t\t%s%s%s %s%s%s\n",
name,
strna(sysext_scope),
strna(sysext_level),
+ strna(id),
+ strna(version_id),
strna(pretty_portable),
strna(portable_prefixes),
- strna(pretty_os),
- strna(id),
- strna(version_id));
+ strempty(pretty_os),
+ pretty_os ? " (" : "ID: ",
+ strna(sysext_id ?: image_id),
+ pretty_os ? "" : "Version: ",
+ strna(sysext_version_id ?: image_version ?: build_id),
+ pretty_os ? ")" : "");
}
r = sd_bus_message_exit_container(reply);