From 97b944c23ac7a8af33fdfce2d218b58021e0f05c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 9 Feb 2024 09:32:00 +0100 Subject: [PATCH 1/4] sysext: fix --help indenting/line breaking Let's make sure there's an empty line after the explanatory text like we usually do it, and do not indent the 2nd line more than the 1st --- src/sysext/sysext.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index 49cedcc24b..260028ccdc 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -1371,8 +1371,9 @@ static int verb_help(int argc, char **argv, void *userdata) { return log_oom(); printf("%1$s [OPTIONS...] COMMAND\n" - "\n%5$sMerge extension images into /usr/ and /opt/ hierarchies for\n" - " sysext and into the /etc/ hierarchy for confext.%6$s\n" + "\n%5$sMerge extension images into /usr/ and /opt/ hierarchies for\n" + "sysext and into the /etc/ hierarchy for confext.%6$s\n" + "\n%3$sCommands:%4$s\n" " status Show current merge status (default)\n" " merge Merge extensions into relevant hierarchies\n" " unmerge Unmerge extensions from relevant hierarchies\n" From 457a74b3d0cfdce9962949b00a9585e00c056578 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 9 Feb 2024 09:32:53 +0100 Subject: [PATCH 2/4] sysext: rename "directory_name" field to "full_identifier" So the field contains simply the full name of the command being invoked, hence rename the field to match the contents, and to mirror the "short_identifier" field. Interestingly, the field is apparently not actually used by anything though! But we are not going to remove it, since a follow-up commit will start making use of it. --- src/sysext/sysext.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index 260028ccdc..924f461301 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -68,10 +68,11 @@ STATIC_DESTRUCTOR_REGISTER(arg_image_policy, image_policy_freep); /* Helper struct for naming simplicity and reusability */ static const struct { - const char *dot_directory_name; - const char *directory_name; + const char *full_identifier; const char *short_identifier; const char *short_identifier_plural; + const char *dot_directory_name; + const char *directory_name; const char *level_env; const char *scope_env; const char *name_env; @@ -79,10 +80,10 @@ static const struct { unsigned long default_mount_flags; } image_class_info[_IMAGE_CLASS_MAX] = { [IMAGE_SYSEXT] = { - .dot_directory_name = ".systemd-sysext", - .directory_name = "systemd-sysext", + .full_identifier = "systemd-sysext", .short_identifier = "sysext", .short_identifier_plural = "extensions", + .dot_directory_name = ".systemd-sysext", .level_env = "SYSEXT_LEVEL", .scope_env = "SYSEXT_SCOPE", .name_env = "SYSTEMD_SYSEXT_HIERARCHIES", @@ -90,10 +91,10 @@ static const struct { .default_mount_flags = MS_RDONLY|MS_NODEV, }, [IMAGE_CONFEXT] = { - .dot_directory_name = ".systemd-confext", - .directory_name = "systemd-confext", + .full_identifier = "systemd-confext", .short_identifier = "confext", .short_identifier_plural = "confexts", + .dot_directory_name = ".systemd-confext", .level_env = "CONFEXT_LEVEL", .scope_env = "CONFEXT_SCOPE", .name_env = "SYSTEMD_CONFEXT_HIERARCHIES", From 82d371eeaf09ae1bec9e6868bcc6f304d1a64d8c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 9 Feb 2024 09:37:23 +0100 Subject: [PATCH 3/4] sysext: point to the right man page for the mode we are invoked in --- src/sysext/sysext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index 924f461301..3a316ff9dc 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -1367,7 +1367,7 @@ static int verb_help(int argc, char **argv, void *userdata) { _cleanup_free_ char *link = NULL; int r; - r = terminal_urlify_man("systemd-sysext", "8", &link); + r = terminal_urlify_man(image_class_info[arg_image_class].full_identifier, "8", &link); if (r < 0) return log_oom(); From 00d0f58443c41c06cf1fe6b105318f7a01874be5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 9 Feb 2024 09:40:11 +0100 Subject: [PATCH 4/4] sysext: output an appropriate blurb for the mode we are executed in --- src/sysext/sysext.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index 3a316ff9dc..6c1bfdb77e 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -71,6 +71,7 @@ static const struct { const char *full_identifier; const char *short_identifier; const char *short_identifier_plural; + const char *blurb; const char *dot_directory_name; const char *directory_name; const char *level_env; @@ -83,6 +84,7 @@ static const struct { .full_identifier = "systemd-sysext", .short_identifier = "sysext", .short_identifier_plural = "extensions", + .blurb = "Merge system extension images into /usr/ and /opt/.", .dot_directory_name = ".systemd-sysext", .level_env = "SYSEXT_LEVEL", .scope_env = "SYSEXT_SCOPE", @@ -94,6 +96,7 @@ static const struct { .full_identifier = "systemd-confext", .short_identifier = "confext", .short_identifier_plural = "confexts", + .blurb = "Merge configuration extension images into /etc/.", .dot_directory_name = ".systemd-confext", .level_env = "CONFEXT_LEVEL", .scope_env = "CONFEXT_SCOPE", @@ -1372,8 +1375,7 @@ static int verb_help(int argc, char **argv, void *userdata) { return log_oom(); printf("%1$s [OPTIONS...] COMMAND\n" - "\n%5$sMerge extension images into /usr/ and /opt/ hierarchies for\n" - "sysext and into the /etc/ hierarchy for confext.%6$s\n" + "\n%5$s%7$s%6$s\n" "\n%3$sCommands:%4$s\n" " status Show current merge status (default)\n" " merge Merge extensions into relevant hierarchies\n" @@ -1399,7 +1401,8 @@ static int verb_help(int argc, char **argv, void *userdata) { ansi_underline(), ansi_normal(), ansi_highlight(), - ansi_normal()); + ansi_normal(), + image_class_info[arg_image_class].blurb); return 0; }