From: Yu Watanabe Date: Sun, 26 Mar 2023 05:57:10 +0000 (+0900) Subject: kernel-install: introduce --make-entry-directory= option X-Git-Tag: v254-rc1~245^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b79621aa99fc427c7d631d8857072bec4be8f359;p=thirdparty%2Fsystemd.git kernel-install: introduce --make-entry-directory= option For consistency with bootctl. However, unlike the same option for bootctl, defaults to 'auto' for backward compatibility. --- diff --git a/man/kernel-install.xml b/man/kernel-install.xml index 835eb36f187..2ee298fc161 100644 --- a/man/kernel-install.xml +++ b/man/kernel-install.xml @@ -189,6 +189,19 @@ + + + + Controls creation and deletion of the + Boot Loader Specification + Type #1 entry directory on the file system containing resources such as kernel and initrd images + during and , respectively. The directory is named after + the entry token, and is placed immediately below the boot root directory. When + auto, the directory is created or removed only when the install layout is + bls. Defaults to auto. + + + diff --git a/src/kernel-install/kernel-install.c b/src/kernel-install/kernel-install.c index 631c054cfca..8db0fbd2f42 100644 --- a/src/kernel-install/kernel-install.c +++ b/src/kernel-install/kernel-install.c @@ -31,6 +31,7 @@ static bool arg_verbose = false; static char *arg_esp_path = NULL; static char *arg_xbootldr_path = NULL; +static int arg_make_entry_directory = -1; /* tristate */ STATIC_DESTRUCTOR_REGISTER(arg_esp_path, freep); STATIC_DESTRUCTOR_REGISTER(arg_xbootldr_path, freep); @@ -762,7 +763,10 @@ static bool context_should_make_entry_dir(Context *c) { /* Compatibility with earlier versions that used the presence of $BOOT_ROOT/$ENTRY_TOKEN to signal to * 00-entry-directory to create $ENTRY_DIR to serve as the indication to use or to not use the BLS */ - return c->layout == LAYOUT_BLS; + if (arg_make_entry_directory < 0) + return c->layout == LAYOUT_BLS; + + return arg_make_entry_directory; } static int context_make_entry_dir(Context *c) { @@ -1114,6 +1118,8 @@ static int help(void) { " -v --verbose Increase verbosity\n" " --esp-path=PATH Path to the EFI System Partition (ESP)\n" " --boot-path=PATH Path to the $BOOT partition\n" + " --make-entry-directory=yes|no|auto\n" + " Create $BOOT/ENTRY-TOKEN/ directory\n" "\nSee the %4$s for details.\n", program_invocation_short_name, ansi_highlight(), @@ -1128,6 +1134,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_VERSION = 0x100, ARG_ESP_PATH, ARG_BOOT_PATH, + ARG_MAKE_ENTRY_DIRECTORY, }; static const struct option options[] = { { "help", no_argument, NULL, 'h' }, @@ -1135,6 +1142,7 @@ static int parse_argv(int argc, char *argv[]) { { "verbose", no_argument, NULL, 'v' }, { "esp-path", required_argument, NULL, ARG_ESP_PATH }, { "boot-path", required_argument, NULL, ARG_BOOT_PATH }, + { "make-entry-directory", required_argument, NULL, ARG_MAKE_ENTRY_DIRECTORY }, {} }; int t, r; @@ -1167,6 +1175,18 @@ static int parse_argv(int argc, char *argv[]) { return log_oom(); break; + case ARG_MAKE_ENTRY_DIRECTORY: + if (streq(optarg, "auto")) + arg_make_entry_directory = -1; + else { + r = parse_boolean_argument("--make-entry-directory=", optarg, NULL); + if (r < 0) + return r; + + arg_make_entry_directory = r; + } + break; + case '?': return -EINVAL;