From 92fbc11f6af9ed15ebc0ba8f8e308ac6113db0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 14 May 2026 11:51:56 +0200 Subject: [PATCH] shared/options: introduce OPTION_COMMON_{ENTRY_TOKEN,MAKE_ENTRY_DIRECTORY} --- src/bootctl/bootctl.c | 6 ++---- src/shared/options.h | 9 +++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/bootctl/bootctl.c b/src/bootctl/bootctl.c index 881bdfb60f..4bb9742a47 100644 --- a/src/bootctl/bootctl.c +++ b/src/bootctl/bootctl.c @@ -554,15 +554,13 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) { arg_quiet = true; break; - OPTION_LONG("entry-token", "TOKEN", - "Entry token to use for this installation" - " (machine-id, os-id, os-image-id, auto, literal:…)"): + OPTION_COMMON_ENTRY_TOKEN: r = parse_boot_entry_token_type(opts.arg, &arg_entry_token_type, &arg_entry_token); if (r < 0) return r; break; - OPTION_LONG("make-entry-directory", "yes|no|auto", "Create $BOOT/ENTRY-TOKEN/ directory"): {} + OPTION_COMMON_MAKE_ENTRY_DIRECTORY: {} OPTION_LONG("make-machine-id-directory", "BOOL", /* help= */ NULL): /* Compatibility alias */ if (streq(opts.arg, "auto")) /* retained for backwards compatibility */ arg_make_entry_directory = -1; /* yes if machine-id is permanent */ diff --git a/src/shared/options.h b/src/shared/options.h index d60c9afe81..5ba276eaee 100644 --- a/src/shared/options.h +++ b/src/shared/options.h @@ -137,6 +137,15 @@ typedef struct Option { OPTION_SHORT('j', NULL, \ "Equivalent to --json=pretty (on TTY) or --json=short (otherwise)") +#define OPTION_COMMON_ENTRY_TOKEN \ + OPTION_LONG("entry-token", "TOKEN", \ + "Entry token to use for this installation " \ + "(machine-id, os-id, os-image-id, auto, literal:…)") + +#define OPTION_COMMON_MAKE_ENTRY_DIRECTORY \ + OPTION_LONG("make-entry-directory", \ + "BOOL|auto", "Create $BOOT/ENTRY-TOKEN/ directory") + #define OPTION_COMMON_PRIVATE_KEY(purpose) \ OPTION_LONG("private-key", "PATH|URI", purpose)