mirror of
https://github.com/systemd/systemd.git
synced 2026-08-07 08:30:57 +00:00
bootctl: don't update $ESP/EFI/BOOTX64.EFI twice
We update BOOTX64.EFI explicitly once (because we know that it's the main entry point of UEFI) and then a second time when we update everything in $ESP/EFI/*.EFI. That's redundant and pretty ugly/confusing in the log output. Hence exclude the file we already updated explicitly from the 2nd run.
This commit is contained in:
committed by
Yu Watanabe
parent
b6f4f85c39
commit
7dd55c83b8
@@ -334,7 +334,11 @@ static int create_subdirs(const char *root, const char * const *subdirs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_efi_boot_binaries(const char *esp_path, const char *source_path) {
|
||||
static int update_efi_boot_binaries(
|
||||
const char *esp_path,
|
||||
const char *source_path,
|
||||
const char *ignore_filename) {
|
||||
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int r, ret = 0;
|
||||
@@ -354,6 +358,9 @@ static int update_efi_boot_binaries(const char *esp_path, const char *source_pat
|
||||
if (!endswith_no_case(de->d_name, ".efi"))
|
||||
continue;
|
||||
|
||||
if (strcaseeq_ptr(ignore_filename, de->d_name))
|
||||
continue;
|
||||
|
||||
fd = xopenat_full(dirfd(d), de->d_name, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY|O_NOFOLLOW, XO_REGULAR, /* mode= */ 0);
|
||||
if (fd < 0)
|
||||
return log_error_errno(fd, "Failed to open \"%s/%s\" for reading: %m", p, de->d_name);
|
||||
@@ -425,7 +432,7 @@ static int copy_one_file(const char *esp_path, const char *name, bool force) {
|
||||
|
||||
/* Create the EFI default boot loader name (specified for removable devices) */
|
||||
v = strjoina("/EFI/BOOT/BOOT", e);
|
||||
ascii_strupper(strrchr(v, '/') + 1);
|
||||
const char *boot_dot_efi = ascii_strupper(strrchr(v, '/') + 1);
|
||||
|
||||
r = chase(v, esp_path, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS|CHASE_NONEXISTENT|CHASE_TRIGGER_AUTOFS, &default_dest_path, NULL);
|
||||
if (r < 0)
|
||||
@@ -433,10 +440,10 @@ static int copy_one_file(const char *esp_path, const char *name, bool force) {
|
||||
|
||||
RET_GATHER(ret, copy_file_with_version_check(source_path, default_dest_path, force));
|
||||
|
||||
/* If we were installed under any other name in /EFI/BOOT, make sure we update those binaries
|
||||
/* If we were installed under any other name in /EFI/BOOT/, make sure we update those binaries
|
||||
* as well. */
|
||||
if (!force)
|
||||
RET_GATHER(ret, update_efi_boot_binaries(esp_path, source_path));
|
||||
RET_GATHER(ret, update_efi_boot_binaries(esp_path, source_path, boot_dot_efi));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user