From 8d8cf2cf1ac173e6b719b6159be0032158c4bf74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 18 Aug 2026 20:47:26 +0200 Subject: [PATCH] report-sign-plain: convert to VERB_COMMAND and add --introspect-cli The custom help() is replaced by a COMMAND() description, and --introspect-cli is added. --- src/report/report-sign-plain.c | 35 ++++++------------- .../units/TEST-74-AUX-UTILS.introspect-cli.sh | 1 + 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/report/report-sign-plain.c b/src/report/report-sign-plain.c index 45f4c86cd6..1f7c760f8c 100644 --- a/src/report/report-sign-plain.c +++ b/src/report/report-sign-plain.c @@ -13,21 +13,25 @@ #include "errno-util.h" #include "fd-util.h" #include "fileio.h" -#include "format-table.h" #include "fs-util.h" -#include "help-util.h" #include "iovec-util.h" #include "json-util.h" #include "lock-util.h" #include "log.h" #include "main-func.h" #include "metrics.h" -#include "options.h" #include "stat-util.h" #include "tmpfile-util.h" #include "varlink-io.systemd.Metrics.h" #include "varlink-io.systemd.Report.Signer.h" #include "varlink-util.h" +#include "verbs.h" + +COMMAND( + "systemd-report-sign-plain\0", + "Sign system reports with a local software key.", + .man_pages = "systemd-report-sign-plain@.service.8\0", +); #define REPORT_SIGN_PLAIN_DIR "/var/lib/systemd/report.sign.plain" #define REPORT_SIGN_PLAIN_PRIVATE_KEY "local.private" @@ -339,26 +343,6 @@ static int vl_server(void) { return 0; } -static int help(void) { - _cleanup_(table_unrefp) Table *options = NULL; - int r; - - r = option_parser_get_help_table(&options); - if (r < 0) - return r; - - help_cmdline("[OPTIONS...]"); - help_abstract("Sign system reports with a local software key."); - help_section("Options"); - - r = table_print_or_warn(options); - if (r < 0) - return r; - - help_man_page_reference("systemd-report-sign-plain@.service", "8"); - return 0; -} - static int parse_argv(int argc, char *argv[]) { int r; @@ -370,10 +354,13 @@ static int parse_argv(int argc, char *argv[]) { FOREACH_OPTION_OR_RETURN(c, &opts) switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-report-sign-plain"); OPTION_COMMON_VERSION: return version(); + + OPTION_COMMON_INTROSPECT_CLI: + return introspect_cli(SD_JSON_FORMAT_OFF); } if (option_parser_get_n_args(&opts) > 0) diff --git a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh index 4d6e376e62..2aa0c25870 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -91,6 +91,7 @@ INTROSPECTABLE=( systemd-report-basic systemd-report-cgroup systemd-report-files + systemd-report-sign-plain systemd-run systemd-sbsign systemd-sleep