From: Mate Kukri Date: Fri, 8 Dec 2023 16:57:55 +0000 (+0000) Subject: util/grub-install: Move platdir path canonicalization after files were copied to... X-Git-Tag: grub-2.12~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=353beb80c0a195d313fe3309d0436e451d1e5dad;p=thirdparty%2Fgrub.git util/grub-install: Move platdir path canonicalization after files were copied to grubdir The commit 3f9eace2d (util/grub-install: Delay copying files to {grubdir,platdir} after install_device was validated) delaying copying of files caused a regression when installing without an existing directory structure. This patch ensures that the platform directory actually exists by the time the code tries to canonicalize its filename. Fixes: 3f9eace2d (util/grub-install: Delay copying files to {grubdir,platdir} after install_device was validated) Signed-off-by: Mate Kukri Reviewed-by: Daniel Kiper --- diff --git a/util/grub-install.c b/util/grub-install.c index 9feb4ea9e..7dc5657bb 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1366,18 +1366,6 @@ main (int argc, char *argv[]) relative_grubdir = xstrdup ("/"); } - char *platname = grub_install_get_platform_name (platform); - char *platdir; - { - char *t = grub_util_path_concat (2, grubdir, - platname); - platdir = grub_canonicalize_file_name (t); - if (!platdir) - grub_util_error (_("failed to get canonical path of `%s'"), - t); - free (t); - } - char *prefix_drive = NULL; char *install_drive = NULL; @@ -1408,6 +1396,18 @@ main (int argc, char *argv[]) if (!grub_util_is_regular (envfile)) grub_util_create_envblk_file (envfile); + char *platname = grub_install_get_platform_name (platform); + char *platdir; + { + char *t = grub_util_path_concat (2, grubdir, + platname); + platdir = grub_canonicalize_file_name (t); + if (!platdir) + grub_util_error (_("failed to get canonical path of `%s'"), + t); + free (t); + } + load_cfg = grub_util_path_concat (2, platdir, "load.cfg");