#include "device-nodes.h"
#include "dirent-util.h"
#include "efivars.h"
+#include "efi-loader.h"
#include "env-file.h"
#include "env-util.h"
#include "fd-util.h"
assert(entry);
free(entry->id);
+ free(entry->id_old);
free(entry->path);
free(entry->root);
free(entry->title);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid loader entry file suffix: %s", path);
b = basename(path);
- tmp.id = strndup(b, c - b);
- if (!tmp.id)
+ tmp.id = strdup(b);
+ tmp.id_old = strndup(b, c - b);
+ if (!tmp.id || !tmp.id_old)
return log_oom();
if (!efi_loader_entry_name_valid(tmp.id))
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid loader entry filename: %s", path);
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid loader entry: %s", tmp.id);
tmp.path = strdup(path);
if (!tmp.path)
free(config->auto_entries);
free(config->auto_firmware);
free(config->console_mode);
+ free(config->random_seed_mode);
free(config->entry_oneshot);
free(config->entry_default);
r = free_and_strdup(&config->auto_firmware, p);
else if (streq(field, "console-mode"))
r = free_and_strdup(&config->console_mode, p);
+ else if (streq(field, "random-seed-mode"))
+ r = free_and_strdup(&config->random_seed_mode, p);
else {
log_notice("%s:%u: Unknown line \"%s\", ignoring.", path, line, field);
continue;
assert(entries);
assert(n_entries);
- r = conf_files_list(&files, ".conf", NULL, 0, dir, NULL);
+ r = conf_files_list(&files, ".conf", NULL, 0, dir);
if (r < 0)
return log_error_errno(r, "Failed to list files in \"%s\": %m", dir);
};
_cleanup_fclose_ FILE *f = NULL;
const char *k;
+ char *b;
int r;
assert(root);
if (!os_pretty_name || !os_id || !(version_id || build_id))
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Missing fields in os-release data from unified kernel image %s, refusing.", path);
- tmp.id = strjoin(os_id, "-", version_id ?: build_id);
- if (!tmp.id)
+ b = basename(path);
+ tmp.id = strdup(b);
+ tmp.id_old = strjoin(os_id, "-", version_id ?: build_id);
+ if (!tmp.id || !tmp.id_old)
return log_oom();
if (!efi_loader_entry_name_valid(tmp.id))
_cleanup_free_ char *j = NULL, *osrelease = NULL, *cmdline = NULL;
_cleanup_close_ int fd = -1;
+ dirent_ensure_type(d, de);
if (!dirent_is_file(de))
continue;
return boot_entries_load_config(esp_where, xbootldr_where, config);
}
-#if ENABLE_EFI
-int boot_entries_augment_from_loader(BootConfig *config, bool only_auto) {
- static const char * const title_table[] = {
+int boot_entries_augment_from_loader(
+ BootConfig *config,
+ char **found_by_loader,
+ bool only_auto) {
+
+ static const char *const title_table[] = {
/* Pretty names for a few well-known automatically discovered entries. */
"auto-osx", "macOS",
"auto-windows", "Windows Boot Manager",
"auto-reboot-to-firmware-setup", "Reboot Into Firmware Interface",
};
- _cleanup_strv_free_ char **found_by_loader = NULL;
size_t n_allocated;
char **i;
- int r;
assert(config);
/* Let's add the entries discovered by the boot loader to the end of our list, unless they are
* already included there. */
- r = efi_loader_get_entries(&found_by_loader);
- if (IN_SET(r, -ENOENT, -EOPNOTSUPP))
- return log_debug_errno(r, "Boot loader reported no entries.");
- if (r < 0)
- return log_error_errno(r, "Failed to determine entries reported by boot loader: %m");
-
n_allocated = config->n_entries;
STRV_FOREACH(i, found_by_loader) {
return 0;
}
-#endif
/********************************************************************************/
errno = 0;
r = blkid_probe_lookup_value(b, "PART_ENTRY_NUMBER", &v, NULL);
if (r != 0)
- return log_error_errno(errno ?: SYNTHETIC_ERRNO(EIO), "Failed to probe partition number of \"%s\": m", node);
+ return log_error_errno(errno ?: SYNTHETIC_ERRNO(EIO), "Failed to probe partition number of \"%s\": %m", node);
r = safe_atou32(v, &part);
if (r < 0)
return log_error_errno(r, "Failed to parse PART_ENTRY_NUMBER field.");