Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
grub2.22048
0002-grub-install-Avoid-incompleted-install-on-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-grub-install-Avoid-incompleted-install-on-i386-pc.patch of Package grub2.22048
From 4cf2e774557c782aa7156b2261d603212b24a64c Mon Sep 17 00:00:00 2001 From: Michael Chang <mchang@suse.com> Date: Sat, 26 Sep 2020 20:29:40 +0800 Subject: [PATCH 2/2] grub-install: Avoid incompleted install on i386-pc If any error happens between grub_install_copy_files() and grub_util_bios_setup(), the system would become unbootable with error like undefined symbol as a result of incompleted install that leaves behind images on disk from different build to the modules on /boot. This patch makes grub_install_copy_files() an adjecent call to grub_util_bios_setup() to minimize the risk of running into any error in between that would abort the process. V1: * Create platform directory, /boot/grub2/i386-pc, which is required to have existed in the process of setting up prefix for the core.img. This fixed "failed to get canonical path of `/boot/grub2/i386-pc`" error during grub-install. V2: Do not clean up core.img and boot.img in i386-pc platform directory. The core.img is required by blocklist install that will load it from platform directory. Both files can be used by grub2-bios-setup to reinstall images to disk made by previous grub2-install. Signed-off-by: Michael Chang <mchang@suse.com> --- util/grub-install.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: grub-2.04/util/grub-install.c =================================================================== --- grub-2.04.orig/util/grub-install.c +++ grub-2.04/util/grub-install.c @@ -1340,8 +1340,9 @@ main (int argc, char *argv[]) } } - grub_install_copy_files (grub_install_source_directory, - grubdir, platform); + if (platform != GRUB_INSTALL_PLATFORM_I386_PC) + 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)) @@ -1430,6 +1431,7 @@ main (int argc, char *argv[]) { char *t = grub_util_path_concat (2, grubdir, platname); + grub_install_mkdir_p (t); platdir = grub_canonicalize_file_name (t); if (!platdir) grub_util_error (_("failed to get canonical path of `%s'"), @@ -1964,6 +1966,8 @@ main (int argc, char *argv[]) fs_probe, allow_floppy, add_rs_codes, warn_short_mbr_gap); } + grub_install_copy_files (grub_install_source_directory, + grubdir, platform); break; } case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275: Index: grub-2.04/util/grub-install-common.c =================================================================== --- grub-2.04.orig/util/grub-install-common.c +++ grub-2.04/util/grub-install-common.c @@ -190,18 +190,28 @@ clean_grub_dir (const char *di) { grub_util_fd_dir_t d; grub_util_fd_dirent_t de; + int skip_img = 0; d = grub_util_fd_opendir (di); if (!d) grub_util_error (_("cannot open directory `%s': %s"), di, grub_util_fd_strerror ()); + { + char *plat_i386_pc = grub_install_get_platform_name (GRUB_INSTALL_PLATFORM_I386_PC); + const char *plat = strrchr (di, '/'); + + if (plat && strcmp (plat + 1, plat_i386_pc) == 0) + skip_img = 1; + free (plat_i386_pc); + } + while ((de = grub_util_fd_readdir (d))) { const char *ext = strrchr (de->d_name, '.'); if ((ext && (strcmp (ext, ".mod") == 0 || strcmp (ext, ".lst") == 0 - || strcmp (ext, ".img") == 0 + || (!skip_img && strcmp (ext, ".img") == 0) || strcmp (ext, ".mo") == 0) && strcmp (de->d_name, "menu.lst") != 0) || strcmp (de->d_name, "efiemu32.o") == 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor