#include "argv-util.h"
#include "boot-entry.h"
+#include "bootspec.h"
#include "build.h"
#include "chase.h"
#include "conf-files.h"
Action action;
sd_id128_t machine_id;
bool machine_id_is_random;
+ BootEntryType entry_type;
KernelImageType kernel_image_type;
Layout layout;
char *layout_other;
return context_set_path_strv(c, strv, "command line", "initrds", &c->initrds);
}
+static int context_set_entry_type(Context *c, const char *s) {
+ assert(c);
+ BootEntryType e;
+ if (isempty(s) || streq(s, "all")) {
+ c->entry_type = _BOOT_ENTRY_TYPE_INVALID;
+ return 0;
+ }
+ e = boot_entry_type_from_string(s);
+ if (e < 0)
+ return log_error_errno(e, "Invalid entry type: %s", s);
+ c->entry_type = e;
+ return 1;
+}
+
static int context_load_environment(Context *c) {
assert(c);
"KERNEL_INSTALL_LAYOUT", context_get_layout(c),
"KERNEL_INSTALL_INITRD_GENERATOR", strempty(c->initrd_generator),
"KERNEL_INSTALL_UKI_GENERATOR", strempty(c->uki_generator),
+ "KERNEL_INSTALL_BOOT_ENTRY_TYPE", boot_entry_type_to_string(c->entry_type),
"KERNEL_INSTALL_STAGING_AREA", c->staging_area);
if (r < 0)
return log_error_errno(r, "Failed to build environment variables for plugins: %m");
" --root=PATH Operate on an alternate filesystem root\n"
" --image=PATH Operate on disk image as filesystem root\n"
" --image-policy=POLICY Specify disk image dissection policy\n"
+ " --entry-type=type1|type2|all\n"
+ " Operate only on the specified bootloader\n"
+ " entry type\n"
"\n"
"This program may also be invoked as 'installkernel':\n"
" installkernel [OPTIONS...] VERSION VMLINUZ [MAP] [INSTALLATION-DIR]\n"
ARG_ROOT,
ARG_IMAGE,
ARG_IMAGE_POLICY,
+ ARG_BOOT_ENTRY_TYPE,
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "image", required_argument, NULL, ARG_IMAGE },
{ "image-policy", required_argument, NULL, ARG_IMAGE_POLICY },
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
+ { "entry-type", required_argument, NULL, ARG_BOOT_ENTRY_TYPE },
{}
};
int t, r;
return r;
break;
+ case ARG_BOOT_ENTRY_TYPE:
+ r = context_set_entry_type(c, optarg);
+ if (r < 0)
+ return r;
+ break;
+
case '?':
return -EINVAL;
.action = _ACTION_INVALID,
.kernel_image_type = KERNEL_IMAGE_TYPE_UNKNOWN,
.layout = _LAYOUT_INVALID,
+ .entry_type = _BOOT_ENTRY_TYPE_INVALID,
.entry_token_type = BOOT_ENTRY_TOKEN_AUTO,
};
_cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL;