sysinstall: convert to VERB_COMMAND and add --introspect-cli

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-08-17 13:21:31 +02:00
parent e70f197e37
commit 2805c192f9
2 changed files with 14 additions and 24 deletions
+13 -24
View File
@@ -4,6 +4,7 @@
#include <sys/stat.h>
#include <unistd.h>
#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);
@@ -54,6 +54,7 @@ INTROSPECTABLE=(
systemd-storage-block
systemd-storage-fs
systemd-storagetm
systemd-sysinstall
systemd-tty-ask-password-agent
systemd-veritysetup
timedatectl