static int install_boot_option(
InstallContext *c,
- const char *path) {
+ const char *path,
+ const char *description,
+ uint16_t *ret_slot) {
uint16_t slot;
int r;
assert(c);
+ assert(path);
+ assert(description);
if (c->esp_fd < 0)
return c->esp_fd;
bool existing = r > 0;
if (c->operation == INSTALL_NEW || !existing) {
- _cleanup_free_ char *description = NULL;
-
- r = pick_efi_boot_option_description(c->esp_fd, &description);
- if (r < 0)
- return r;
-
r = efi_add_boot_option(
slot,
description,
description);
}
- return insert_into_order(c, slot);
+ r = insert_into_order(c, slot);
+ if (r < 0)
+ return r;
+
+ if (ret_slot)
+ *ret_slot = slot;
+
+ return 0;
}
static int are_we_installed(InstallContext *c) {
}
char *path = strjoina("/EFI/systemd/systemd-boot", arch, ".efi");
- return install_boot_option(c, path);
+
+ _cleanup_free_ char *description = NULL;
+ r = pick_efi_boot_option_description(c->esp_fd, &description);
+ if (r < 0)
+ return r;
+
+ return install_boot_option(c, path, description, /* ret_slot= */ NULL);
}
int verb_install(int argc, char *argv[], uintptr_t _data, void *userdata) {