[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] grub-install: Delay copying files to grubdir after install_devic
From: |
Mate Kukri |
Subject: |
[PATCH] grub-install: Delay copying files to grubdir after install_device was validated. |
Date: |
Tue, 21 Nov 2023 16:20:58 +0000 |
Previously grub-install copied modules to grubdir before doing any validation on
the install_device.
When grub-install was called with an invalid install_device, modules
were already copied to /boot before it found out and was forced to rely
on atexit rollback.
This patch delays copying the modules after at least some install_device
validation was done, and thus reduces reliance on successful rollback.
---
util/grub-install.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/util/grub-install.c b/util/grub-install.c
index 565505fd2..4000781c9 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1429,13 +1429,6 @@ main (int argc, char *argv[])
}
}
- grub_install_copy_files (grub_install_source_directory,
- grubdir, platform);
-
- char *envfile = grub_util_path_concat (2, grubdir, "grubenv");
- if (!grub_util_is_regular (envfile))
- grub_util_create_envblk_file (envfile);
-
size_t ndev = 0;
/* Write device to a variable so we don't have to traverse /dev
every time. */
@@ -1557,6 +1550,13 @@ main (int argc, char *argv[])
}
}
+ grub_install_copy_files (grub_install_source_directory,
+ grubdir, platform);
+
+ char *envfile = grub_util_path_concat (2, grubdir, "grubenv");
+ if (!grub_util_is_regular (envfile))
+ grub_util_create_envblk_file (envfile);
+
char *efi_signed = NULL;
switch (platform)
{
--
2.39.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] grub-install: Delay copying files to grubdir after install_device was validated.,
Mate Kukri <=