firstboot: 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 ("Configure …" instead of "Configures …"), consistent with the
other commands.
This commit is contained in:
+12
-24
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "sd-bus.h"
|
||||
#include "sd-id128.h"
|
||||
#include "sd-json.h"
|
||||
#include "sd-varlink.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
@@ -26,10 +27,8 @@
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "firstboot-util.h"
|
||||
#include "format-table.h"
|
||||
#include "fs-util.h"
|
||||
#include "glyph-util.h"
|
||||
#include "help-util.h"
|
||||
#include "hostname-setup.h"
|
||||
#include "hostname-util.h"
|
||||
#include "image-policy.h"
|
||||
@@ -43,7 +42,6 @@
|
||||
#include "main-func.h"
|
||||
#include "memory-util.h"
|
||||
#include "mount-util.h"
|
||||
#include "options.h"
|
||||
#include "os-util.h"
|
||||
#include "parse-argument.h"
|
||||
#include "password-quality-util.h"
|
||||
@@ -60,6 +58,7 @@
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
#include "vconsole-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static char *arg_root = NULL;
|
||||
static char *arg_image = NULL;
|
||||
@@ -110,6 +109,12 @@ STATIC_DESTRUCTOR_REGISTER(arg_kernel_cmdline, freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_image_policy, image_policy_freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_label_context, mac_label_context_freep);
|
||||
|
||||
COMMAND(
|
||||
"systemd-firstboot\0",
|
||||
"Configure basic settings of the system.",
|
||||
.man_pages = "systemd-firstboot.1\0",
|
||||
);
|
||||
|
||||
static bool welcome_done = false;
|
||||
|
||||
static void print_welcome(int rfd, sd_varlink **mute_console_link) {
|
||||
@@ -1378,26 +1383,6 @@ static int process_reset(int rfd) {
|
||||
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("Configures basic settings of the system.");
|
||||
help_section("Options");
|
||||
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_man_page_reference("systemd-firstboot", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
@@ -1409,7 +1394,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("systemd-firstboot");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
@@ -1628,6 +1613,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
OPTION_LONG("reset", NULL, "Remove existing files"):
|
||||
arg_reset = true;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (arg_delete_root_password && (arg_copy_root_password || arg_root_password || arg_prompt_root_password))
|
||||
|
||||
@@ -16,6 +16,7 @@ INTROSPECTABLE=(
|
||||
systemd-ask-password
|
||||
systemd-backlight
|
||||
systemd-dissect
|
||||
systemd-firstboot
|
||||
systemd-id128
|
||||
systemd-notify
|
||||
systemd-veritysetup
|
||||
|
||||
Reference in New Issue
Block a user