Another batch of conversions to COMMAND and additions of --introspect-cli (#43436)
This is another batch of straightforward conversions. I wanted to do udevadm here too, but it requires some design work.
This commit is contained in:
+11
-43
@@ -4,20 +4,18 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sd-event.h"
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "ansi-color.h"
|
||||
#include "build.h"
|
||||
#include "discover-image.h"
|
||||
#include "dlopen-note.h"
|
||||
#include "export-raw.h"
|
||||
#include "export-tar.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "import-common.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "runtime-scope.h"
|
||||
#include "signal-util.h"
|
||||
#include "string-util.h"
|
||||
@@ -29,6 +27,11 @@ static Compression arg_compress = _COMPRESSION_INVALID;
|
||||
static ImageClass arg_class = IMAGE_MACHINE;
|
||||
static RuntimeScope arg_runtime_scope = _RUNTIME_SCOPE_INVALID;
|
||||
|
||||
COMMAND(
|
||||
"systemd-export\0",
|
||||
"Export disk images.",
|
||||
);
|
||||
|
||||
static void determine_compression_from_filename(const char *p) {
|
||||
if (arg_compress >= 0)
|
||||
return;
|
||||
@@ -194,45 +197,7 @@ static int verb_export_raw(int argc, char *argv[], uintptr_t _data, void *userda
|
||||
return -r;
|
||||
}
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_(table_unrefp) Table *options = NULL, *verbs = NULL;
|
||||
int r;
|
||||
|
||||
r = verbs_get_help_table(&verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = option_parser_get_help_table(&options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) table_sync_column_widths(0, verbs, options);
|
||||
|
||||
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
|
||||
"%sExport disk images.%s\n"
|
||||
"\n%sCommands:%s\n",
|
||||
program_invocation_short_name,
|
||||
ansi_highlight(),
|
||||
ansi_normal(),
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
printf("\n%sOptions:%s\n",
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VERB_COMMON_HELP_HIDDEN(help);
|
||||
VERB_COMMON_HELP_AUTO_HIDDEN("systemd-export");
|
||||
|
||||
static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
assert(argc >= 0);
|
||||
@@ -245,7 +210,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("systemd-export");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
@@ -271,6 +236,9 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
OPTION_COMMON_USER:
|
||||
arg_runtime_scope = RUNTIME_SCOPE_USER;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (arg_runtime_scope == RUNTIME_SCOPE_USER)
|
||||
|
||||
+12
-43
@@ -3,15 +3,15 @@
|
||||
#include <locale.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "ansi-color.h"
|
||||
#include "btrfs-util.h"
|
||||
#include "build.h"
|
||||
#include "copy.h"
|
||||
#include "discover-image.h"
|
||||
#include "dlopen-note.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "format-util.h"
|
||||
#include "import-common.h"
|
||||
#include "import-util.h"
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "mkdir.h"
|
||||
#include "options.h"
|
||||
#include "parse-argument.h"
|
||||
#include "path-util.h"
|
||||
#include "ratelimit.h"
|
||||
@@ -43,6 +42,11 @@ static RuntimeScope arg_runtime_scope = _RUNTIME_SCOPE_INVALID;
|
||||
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_image_root, freep);
|
||||
|
||||
COMMAND(
|
||||
"systemd-import-fs\0",
|
||||
"Import container images from file system directories.",
|
||||
);
|
||||
|
||||
typedef struct ProgressInfo {
|
||||
RateLimit limit;
|
||||
char *path;
|
||||
@@ -268,45 +272,7 @@ static int verb_import_fs(int argc, char *argv[], uintptr_t _data, void *userdat
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_(table_unrefp) Table *options = NULL, *verbs = NULL;
|
||||
int r;
|
||||
|
||||
r = verbs_get_help_table(&verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = option_parser_get_help_table(&options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) table_sync_column_widths(0, verbs, options);
|
||||
|
||||
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
|
||||
"%sImport container images from file system directories.%s\n"
|
||||
"\n%sCommands:%s\n",
|
||||
program_invocation_short_name,
|
||||
ansi_highlight(),
|
||||
ansi_normal(),
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
printf("\n%sOptions:%s\n",
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VERB_COMMON_HELP_HIDDEN(help);
|
||||
VERB_COMMON_HELP_AUTO_HIDDEN("systemd-import-fs");
|
||||
|
||||
static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
assert(argc >= 0);
|
||||
@@ -320,7 +286,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("systemd-import-fs");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
@@ -377,6 +343,9 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
OPTION_COMMON_USER:
|
||||
arg_runtime_scope = RUNTIME_SCOPE_USER;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (!arg_image_root) {
|
||||
|
||||
+11
-43
@@ -4,22 +4,20 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sd-event.h"
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "ansi-color.h"
|
||||
#include "build.h"
|
||||
#include "discover-image.h"
|
||||
#include "dlopen-note.h"
|
||||
#include "env-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "import-raw.h"
|
||||
#include "import-tar.h"
|
||||
#include "import-util.h"
|
||||
#include "io-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "parse-argument.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
@@ -36,6 +34,11 @@ static RuntimeScope arg_runtime_scope = _RUNTIME_SCOPE_INVALID;
|
||||
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_image_root, freep);
|
||||
|
||||
COMMAND(
|
||||
"systemd-import\0",
|
||||
"Import disk images.",
|
||||
);
|
||||
|
||||
static int normalize_local(const char *local, char **ret) {
|
||||
_cleanup_free_ char *ll = NULL;
|
||||
int r;
|
||||
@@ -272,45 +275,7 @@ static int verb_raw(int argc, char *argv[], uintptr_t _data, void *userdata) {
|
||||
return -r;
|
||||
}
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_(table_unrefp) Table *options = NULL, *verbs = NULL;
|
||||
int r;
|
||||
|
||||
r = verbs_get_help_table(&verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = option_parser_get_help_table(&options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) table_sync_column_widths(0, verbs, options);
|
||||
|
||||
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
|
||||
"%sImport disk images.%s\n"
|
||||
"\n%sCommands:%s\n",
|
||||
program_invocation_short_name,
|
||||
ansi_highlight(),
|
||||
ansi_normal(),
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
printf("\n%sOptions:%s\n",
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VERB_COMMON_HELP_HIDDEN(help);
|
||||
VERB_COMMON_HELP_AUTO_HIDDEN("systemd-import");
|
||||
|
||||
static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
int r;
|
||||
@@ -324,7 +289,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("systemd-import");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
@@ -418,6 +383,9 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
OPTION_COMMON_USER:
|
||||
arg_runtime_scope = RUNTIME_SCOPE_USER;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
/* Make sure offset+size is still in the valid range if both set */
|
||||
|
||||
+11
-44
@@ -1,17 +1,15 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sd-event.h"
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "ansi-color.h"
|
||||
#include "build.h"
|
||||
#include "discover-image.h"
|
||||
#include "dlopen-note.h"
|
||||
#include "env-util.h"
|
||||
#include "format-table.h"
|
||||
#include "hexdecoct.h"
|
||||
#include "import-common.h"
|
||||
#include "import-util.h"
|
||||
@@ -20,7 +18,6 @@
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "oci-util.h"
|
||||
#include "options.h"
|
||||
#include "parse-argument.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
@@ -44,6 +41,11 @@ static RuntimeScope arg_runtime_scope = _RUNTIME_SCOPE_INVALID;
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_checksum, iovec_done);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_image_root, freep);
|
||||
|
||||
COMMAND(
|
||||
"systemd-pull\0",
|
||||
"Download disk images.",
|
||||
);
|
||||
|
||||
static int normalize_local(const char *local, const char *url, char **ret) {
|
||||
_cleanup_free_ char *ll = NULL;
|
||||
int r;
|
||||
@@ -318,45 +320,7 @@ static int verb_oci(int argc, char *argv[], uintptr_t _data, void *userdata) {
|
||||
return -r;
|
||||
}
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_(table_unrefp) Table *options = NULL, *verbs = NULL;
|
||||
int r;
|
||||
|
||||
r = verbs_get_help_table(&verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = option_parser_get_help_table(&options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) table_sync_column_widths(0, verbs, options);
|
||||
|
||||
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
|
||||
"%sDownload disk images.%s\n"
|
||||
"\n%sCommands:%s\n",
|
||||
program_invocation_short_name,
|
||||
ansi_highlight(),
|
||||
ansi_normal(),
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
printf("\n%sOptions:%s\n",
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VERB_COMMON_HELP_HIDDEN(help);
|
||||
VERB_COMMON_HELP_AUTO_HIDDEN("systemd-pull");
|
||||
|
||||
static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
int r;
|
||||
@@ -371,7 +335,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("systemd-pull");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
@@ -545,6 +509,9 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
OPTION_COMMON_USER:
|
||||
arg_runtime_scope = RUNTIME_SCOPE_USER;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
/* Make sure offset+size is still in the valid range if both set */
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "sd-json.h"
|
||||
#include "sd-varlink.h"
|
||||
|
||||
#include "ansi-color.h"
|
||||
#include "build.h"
|
||||
#include "format-table.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "report-basic.h"
|
||||
#include "varlink-io.systemd.Metrics.h"
|
||||
#include "varlink-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
COMMAND(
|
||||
"systemd-report-basic\0",
|
||||
"Generate a report describing the current system.",
|
||||
);
|
||||
|
||||
static int vl_server(void) {
|
||||
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL;
|
||||
@@ -38,26 +42,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;
|
||||
|
||||
printf("%s [OPTIONS...]\n"
|
||||
"\n%sGenerate a report describing the current system%s\n"
|
||||
"\n%sOptions:%s\n",
|
||||
program_invocation_short_name,
|
||||
ansi_highlight(),
|
||||
ansi_normal(),
|
||||
ansi_underline(),
|
||||
ansi_normal());
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
int r;
|
||||
|
||||
@@ -69,10 +53,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-basic");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (option_parser_get_n_args(&opts) > 0)
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "sd-json.h"
|
||||
#include "sd-varlink.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "report-cgroup.h"
|
||||
#include "varlink-io.systemd.Metrics.h"
|
||||
#include "varlink-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
COMMAND(
|
||||
"systemd-report-cgroup\0",
|
||||
"Report cgroup metrics.",
|
||||
);
|
||||
|
||||
static int vl_server(void) {
|
||||
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL;
|
||||
@@ -38,26 +42,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("Report cgroup metrics.");
|
||||
|
||||
help_section("Options");
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_man_page_reference("systemd-report-cgroup", "8");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
int r;
|
||||
|
||||
@@ -70,10 +54,13 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("systemd-report-cgroup");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (option_parser_get_n_args(&opts) > 0)
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "sd-json.h"
|
||||
#include "sd-varlink.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "report-files.h"
|
||||
#include "varlink-io.systemd.Metrics.h"
|
||||
#include "varlink-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
COMMAND(
|
||||
"systemd-report-files\0",
|
||||
"Report the contents of files as system report metrics.",
|
||||
.man_pages = "systemd-report-files@.service.8\0",
|
||||
);
|
||||
|
||||
static int vl_server(void) {
|
||||
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL;
|
||||
@@ -38,26 +43,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("Report the contents of files as system report metrics.");
|
||||
help_section("Options");
|
||||
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_man_page_reference("systemd-report-files@.service", "8");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
int r;
|
||||
|
||||
@@ -69,10 +54,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-files");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (option_parser_get_n_args(&opts) > 0)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -4,18 +4,23 @@
|
||||
#include "sd-varlink.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "iovec-util.h"
|
||||
#include "json-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "sha256.h"
|
||||
#include "string-util.h"
|
||||
#include "tsm-report.h"
|
||||
#include "varlink-io.systemd.Report.Signer.h"
|
||||
#include "varlink-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
COMMAND(
|
||||
"systemd-report-sign-tsm\0",
|
||||
"Get an attestation report via configfs Trusted Security Module (TSM) "
|
||||
"that includes the hash of the system report.",
|
||||
.man_pages = "systemd-report-sign-tsm@.service.8\0",
|
||||
);
|
||||
|
||||
typedef struct SignParameters {
|
||||
struct iovec digest;
|
||||
@@ -101,27 +106,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("Get an attestation report via configfs Trusted Security Module (TSM) "
|
||||
"that includes the hash of the system report.");
|
||||
help_section("Options");
|
||||
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_man_page_reference("systemd-report-sign-tsm@.service", "8");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
int r;
|
||||
|
||||
@@ -133,9 +117,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-tsm");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (option_parser_get_n_args(&opts) > 0)
|
||||
|
||||
+13
-18
@@ -13,24 +13,30 @@
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "device-nodes.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "strv.h"
|
||||
#include "udev-util.h"
|
||||
#include "unaligned.h"
|
||||
#include "verbs.h"
|
||||
|
||||
#define COMMAND_TIMEOUT_MSEC (30 * 1000)
|
||||
|
||||
static bool arg_export = false;
|
||||
static const char *arg_device = NULL;
|
||||
|
||||
COMMAND(
|
||||
"ata_id\0",
|
||||
"Identify ATA storage devices.",
|
||||
.argspec = "DEVICE\0",
|
||||
);
|
||||
|
||||
static int disk_scsi_inquiry_command(
|
||||
int fd,
|
||||
void *buf,
|
||||
@@ -359,20 +365,6 @@ static int disk_identify(int fd,
|
||||
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...] DEVICE");
|
||||
help_section("Options");
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
@@ -383,7 +375,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("ata_id");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
@@ -392,6 +384,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
"Print values as environment keys"):
|
||||
arg_export = true;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
char **args = option_parser_get_args(&opts);
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
#include <scsi/sg.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "random-util.h"
|
||||
#include "sort-util.h"
|
||||
#include "string-table.h"
|
||||
@@ -24,12 +23,19 @@
|
||||
#include "time-util.h"
|
||||
#include "udev-util.h"
|
||||
#include "unaligned.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static bool arg_eject = false;
|
||||
static bool arg_lock = false;
|
||||
static bool arg_unlock = false;
|
||||
static const char *arg_node = NULL;
|
||||
|
||||
COMMAND(
|
||||
"cdrom_id\0",
|
||||
"Identify CD/DVD drives and their media.",
|
||||
.argspec = "DEVICE\0",
|
||||
);
|
||||
|
||||
typedef enum Feature {
|
||||
FEATURE_RW_NONREMOVABLE = 0x01,
|
||||
FEATURE_RW_REMOVABLE = 0x02,
|
||||
@@ -900,20 +906,6 @@ static void print_properties(const Context *c) {
|
||||
printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%u\n", c->media_track_count_data);
|
||||
}
|
||||
|
||||
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...] DEVICE");
|
||||
help_section("Options");
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
@@ -924,7 +916,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("cdrom_id");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
@@ -950,6 +942,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
log_set_max_level(LOG_DEBUG);
|
||||
log_open();
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
char **args = option_parser_get_args(&opts);
|
||||
|
||||
@@ -44,17 +44,17 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
#include "fileio.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "string-util.h"
|
||||
#include "udev-util.h"
|
||||
#include "unaligned.h"
|
||||
#include "utf8.h"
|
||||
#include "verbs.h"
|
||||
|
||||
#define SUPPORTED_SMBIOS_VER 0x030300
|
||||
|
||||
@@ -81,6 +81,11 @@ struct dmi_header {
|
||||
|
||||
static const char *arg_source_file = NULL;
|
||||
|
||||
COMMAND(
|
||||
"dmi_memory_id\0",
|
||||
"Identify memory devices from DMI/SMBIOS data.",
|
||||
);
|
||||
|
||||
static bool verify_checksum(const uint8_t *buf, size_t len) {
|
||||
uint8_t sum = 0;
|
||||
|
||||
@@ -644,20 +649,6 @@ static int legacy_decode(const uint8_t *buf, const char *devmem, bool no_file_of
|
||||
devmem, no_file_offset);
|
||||
}
|
||||
|
||||
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_section("Options");
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
@@ -668,7 +659,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("dmi_memory_id");
|
||||
|
||||
OPTION_COMMON_VERSION_WITH_HIDDEN_V:
|
||||
return version();
|
||||
@@ -677,6 +668,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
"Read DMI information from a binary file"):
|
||||
arg_source_file = opts.arg;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (option_parser_get_n_args(&opts) > 0)
|
||||
|
||||
+12
-18
@@ -11,37 +11,28 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fido_id_desc.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "path-util.h"
|
||||
#include "strv.h"
|
||||
#include "udev-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static const char *arg_device = NULL;
|
||||
|
||||
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...] SYSFS_PATH");
|
||||
help_abstract("Identify FIDO security tokens.");
|
||||
help_section("Options");
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
COMMAND(
|
||||
"fido_id\0",
|
||||
"Identify FIDO security tokens.",
|
||||
.argspec = "[SYSFS_PATH]\0",
|
||||
);
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
@@ -53,10 +44,13 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("fido_id");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
char **args = option_parser_get_args(&opts);
|
||||
|
||||
+12
-31
@@ -3,6 +3,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sd-device.h"
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
@@ -10,10 +11,7 @@
|
||||
#include "conf-parser.h"
|
||||
#include "device-util.h"
|
||||
#include "devnum-util.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "udev-util.h"
|
||||
@@ -22,6 +20,12 @@
|
||||
static char *arg_target_solution = NULL;
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_target_solution, freep);
|
||||
|
||||
COMMAND(
|
||||
"iocost\0",
|
||||
"Set up iocost model and qos solutions for block devices.",
|
||||
.man_pages = "iocost.conf.5\0",
|
||||
);
|
||||
|
||||
static int parse_config(void) {
|
||||
static const ConfigTableItem items[] = {
|
||||
{ "IOCost", "TargetSolution", config_parse_string, 0, &arg_target_solution },
|
||||
@@ -51,33 +55,7 @@ static int parse_config(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_(table_unrefp) Table *options = NULL, *verbs = NULL;
|
||||
int r;
|
||||
|
||||
r = option_parser_get_help_table(&options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = verbs_get_help_table(&verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) table_sync_column_widths(0, options, verbs);
|
||||
|
||||
help_cmdline("[OPTIONS...] COMMAND");
|
||||
help_abstract("Set up iocost model and qos solutions for block devices.");
|
||||
|
||||
help_section("Commands");
|
||||
r = table_print_or_warn(verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_section("Options");
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
|
||||
VERB_COMMON_HELP_HIDDEN(help);
|
||||
VERB_COMMON_HELP_AUTO_HIDDEN("iocost");
|
||||
|
||||
static int parse_argv(int argc, char *argv[], char ***remaining_args) {
|
||||
assert(argc >= 0);
|
||||
@@ -90,10 +68,13 @@ static int parse_argv(int argc, char *argv[], char ***remaining_args) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("iocost");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
*remaining_args = option_parser_get_args(&opts);
|
||||
|
||||
@@ -22,33 +22,24 @@
|
||||
#include <mtd/mtd-user.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "mtd_probe.h"
|
||||
#include "options.h"
|
||||
#include "strv.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static const char *arg_device = NULL;
|
||||
|
||||
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...] /dev/mtd[n]");
|
||||
help_abstract("Probe MTD devices.");
|
||||
help_section("Options");
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
COMMAND(
|
||||
"mtd_probe\0",
|
||||
"Probe MTD devices.",
|
||||
.argspec = "/dev/mtdN\0",
|
||||
);
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
@@ -60,10 +51,13 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("mtd_probe");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
char **args = option_parser_get_args(&opts);
|
||||
|
||||
+13
-19
@@ -8,16 +8,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
#include "device-nodes.h"
|
||||
#include "extract-word.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "parse-util.h"
|
||||
#include "scsi_id.h"
|
||||
#include "string-util.h"
|
||||
@@ -25,6 +24,7 @@
|
||||
#include "strxcpyx.h"
|
||||
#include "udev-util.h"
|
||||
#include "utf8.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static bool all_good = false;
|
||||
static bool dev_specified = false;
|
||||
@@ -40,6 +40,12 @@ static char model_enc_str[256];
|
||||
static char revision_str[16];
|
||||
static char type_str[16];
|
||||
|
||||
COMMAND(
|
||||
"scsi_id\0",
|
||||
"Identify SCSI devices.",
|
||||
.argspec = "[DEVICE]\0",
|
||||
);
|
||||
|
||||
static void set_type(unsigned type_num, char *to, size_t len) {
|
||||
const char *type;
|
||||
|
||||
@@ -206,21 +212,6 @@ static int parse_page_code(const char *value, enum page_code *ret) {
|
||||
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("[OPTION...] DEVICE");
|
||||
help_abstract("SCSI device identification.");
|
||||
help_section("Options");
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
|
||||
static int set_options(int argc, char **argv, char *maj_min_dev) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
@@ -232,7 +223,7 @@ static int set_options(int argc, char **argv, char *maj_min_dev) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("scsi_id");
|
||||
|
||||
OPTION_COMMON_VERSION_WITH_HIDDEN_V:
|
||||
return version();
|
||||
@@ -284,6 +275,9 @@ static int set_options(int argc, char **argv, char *maj_min_dev) {
|
||||
OPTION('x', "export", NULL, "Print values as environment keys"):
|
||||
export = true;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
char **args = option_parser_get_args(&opts);
|
||||
|
||||
+12
-18
@@ -8,34 +8,25 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "options.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "utf8.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static const char *arg_device = NULL;
|
||||
|
||||
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...] DEVICE");
|
||||
help_abstract("Video4Linux device identification.");
|
||||
help_section("Options");
|
||||
|
||||
return table_print_or_warn(options);
|
||||
}
|
||||
COMMAND(
|
||||
"v4l_id\0",
|
||||
"Identify Video4Linux devices.",
|
||||
.argspec = "DEVICE\0",
|
||||
);
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
@@ -47,10 +38,13 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
switch (c) {
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_help("v4l_id");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
char **args = option_parser_get_args(&opts);
|
||||
|
||||
@@ -3,29 +3,36 @@
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
# Some commands are in $PATH, others are in our private directory.
|
||||
# Check the other location too.
|
||||
PATH=$PATH:/usr/lib/systemd
|
||||
# Some commands are in $PATH, others are in our private directories.
|
||||
# Check the other locations too.
|
||||
PATH=$PATH:/usr/lib/systemd:/usr/lib/udev
|
||||
|
||||
export SYSTEMD_PAGER=cat
|
||||
|
||||
# A smoke test for the introspection code
|
||||
INTROSPECTABLE=(
|
||||
ata_id
|
||||
bootctl
|
||||
busctl
|
||||
cdrom_id
|
||||
coredumpctl
|
||||
dmi_memory_id
|
||||
fido_id
|
||||
homectl
|
||||
hostnamectl
|
||||
importctl
|
||||
iocost
|
||||
journalctl
|
||||
localectl
|
||||
loginctl
|
||||
machinectl
|
||||
mtd_probe
|
||||
networkctl
|
||||
oomctl
|
||||
portablectl
|
||||
resolvectl
|
||||
run0
|
||||
scsi_id
|
||||
storagectl
|
||||
systemd-ac-power
|
||||
systemd-analyze
|
||||
@@ -47,6 +54,7 @@ INTROSPECTABLE=(
|
||||
systemd-detect-virt
|
||||
systemd-dissect
|
||||
systemd-escape
|
||||
systemd-export
|
||||
systemd-factory-reset
|
||||
systemd-firstboot
|
||||
systemd-growfs
|
||||
@@ -55,6 +63,8 @@ INTROSPECTABLE=(
|
||||
systemd-id128
|
||||
systemd-imds
|
||||
systemd-imdsd
|
||||
systemd-import
|
||||
systemd-import-fs
|
||||
systemd-inhibit
|
||||
systemd-journal-gatewayd
|
||||
systemd-journal-remote
|
||||
@@ -74,9 +84,15 @@ INTROSPECTABLE=(
|
||||
systemd-pcrextend
|
||||
systemd-pcrlock
|
||||
systemd-pty-forward
|
||||
systemd-pull
|
||||
systemd-random-seed
|
||||
systemd-repart
|
||||
systemd-report
|
||||
systemd-report-basic
|
||||
systemd-report-cgroup
|
||||
systemd-report-files
|
||||
systemd-report-sign-plain
|
||||
systemd-report-sign-tsm
|
||||
systemd-run
|
||||
systemd-sbsign
|
||||
systemd-sleep
|
||||
@@ -103,6 +119,7 @@ INTROSPECTABLE=(
|
||||
timedatectl
|
||||
updatectl
|
||||
userdbctl
|
||||
v4l_id
|
||||
varlinkctl
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user