From 2805c192f94ab8fa3718c3f6a71b3750542962e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 16 Aug 2026 14:40:26 +0200 Subject: [PATCH] sysinstall: convert to VERB_COMMAND and add --introspect-cli MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The custom help() is replaced by a COMMAND() description, and --introspect-cli is added. The abstract is changed to use the imperative form ("Install …" instead of "Installs …"), consistent with the other commands. This also fixes the doubled colon in the "Options::" heading. --- src/sysinstall/sysinstall.c | 37 +++++++------------ .../units/TEST-74-AUX-UTILS.introspect-cli.sh | 1 + 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/sysinstall/sysinstall.c b/src/sysinstall/sysinstall.c index b3b730b914..13269999a2 100644 --- a/src/sysinstall/sysinstall.c +++ b/src/sysinstall/sysinstall.c @@ -4,6 +4,7 @@ #include #include +#include "sd-json.h" #include "sd-varlink.h" #include "alloc-util.h" @@ -27,7 +28,6 @@ #include "fs-util.h" #include "glyph-util.h" #include "hashmap.h" -#include "help-util.h" #include "image-policy.h" #include "json-util.h" #include "locale-setup.h" @@ -36,7 +36,6 @@ #include "machine-credential.h" #include "main-func.h" #include "mount-util.h" -#include "options.h" #include "os-util.h" #include "parse-argument.h" #include "parse-util.h" @@ -47,6 +46,7 @@ #include "terminal-util.h" #include "varlink-io.systemd.SysInstall.h" #include "varlink-util.h" +#include "verbs.h" static char *arg_node = NULL; static bool arg_welcome = true; @@ -70,6 +70,13 @@ STATIC_DESTRUCTOR_REGISTER(arg_definitions, strv_freep); STATIC_DESTRUCTOR_REGISTER(arg_kernel_image, freep); STATIC_DESTRUCTOR_REGISTER(arg_credentials, machine_credential_context_done); +COMMAND( + "systemd-sysinstall\0", + "Install the OS to another block device.", + .argspec = "[DEVICE]\0", + .man_pages = "systemd-sysinstall.8\0", +); + typedef enum ProgressPhase { PROGRESS_ENCRYPT_CREDENTIALS, PROGRESS_INSTALL_PARTITIONS, @@ -155,27 +162,6 @@ static void sysinstall_context_done(SysInstallContext *c) { sd_varlink_unref(c->link); } -static int help(void) { - int r; - - _cleanup_(table_unrefp) Table *options = NULL; - r = option_parser_get_help_table(&options); - if (r < 0) - return r; - - help_cmdline("[OPTIONS...] [DEVICE]"); - help_abstract("Installs the OS to another block device."); - help_section("Options:"); - - r = table_print_or_warn(options); - if (r < 0) - return r; - - help_man_page_reference("systemd-sysinstall", "8"); - - return 0; -} - static int parse_argv(int argc, char *argv[]) { int r; @@ -188,7 +174,7 @@ static int parse_argv(int argc, char *argv[]) { switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-sysinstall"); OPTION_COMMON_VERSION: return version(); @@ -289,6 +275,9 @@ static int parse_argv(int argc, char *argv[]) { if (r < 0) return r; break; + + OPTION_COMMON_INTROSPECT_CLI: + return introspect_cli(SD_JSON_FORMAT_OFF); } char **args = option_parser_get_args(&opts); diff --git a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh index 89f0be5001..5e4a73be46 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -54,6 +54,7 @@ INTROSPECTABLE=( systemd-storage-block systemd-storage-fs systemd-storagetm + systemd-sysinstall systemd-tty-ask-password-agent systemd-veritysetup timedatectl