[gnome-build-meta/abderrahim/fix-ostree: 2/2] files/ostree/no-boot-symlink.patch: fix the patch to avoid symlinks




commit 8d8a53d5efc3e666ef2aa5d43a3cb7b2e6c64983
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Sun Mar 14 18:06:13 2021 +0100

    files/ostree/no-boot-symlink.patch: fix the patch to avoid symlinks
    
    This was poorly done in the patch refresh in 234be036c5
    
    Fixes #361

 files/ostree/no-boot-symlink.patch | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/files/ostree/no-boot-symlink.patch b/files/ostree/no-boot-symlink.patch
index 1d8145a5..76d585db 100644
--- a/files/ostree/no-boot-symlink.patch
+++ b/files/ostree/no-boot-symlink.patch
@@ -19,10 +19,10 @@ index 27122834..a99d4bb6 100644
    /* These directories are for the other major version */
    g_string_truncate (buf, 0); g_string_append_printf (buf, "boot/loader.%d", cleanup_bootversion);
 diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
-index 900efe49..baefaddd 100644
+index 900efe49..758791e2 100644
 --- a/src/libostree/ostree-sysroot-deploy.c
 +++ b/src/libostree/ostree-sysroot-deploy.c
-@@ -2030,18 +2030,16 @@ install_deployment_kernel (OstreeSysroot   *sysroot,
+@@ -2030,44 +2030,89 @@ install_deployment_kernel (OstreeSysroot   *sysroot,
    return TRUE;
  }
  
@@ -49,18 +49,21 @@ index 900efe49..baefaddd 100644
    g_assert ((current_bootversion == 0 && new_bootversion == 1) ||
              (current_bootversion == 1 && new_bootversion == 0));
  
-@@ -2051,23 +2049,76 @@ prepare_new_bootloader_link (OstreeSysroot  *sysroot,
-     if (errno != EEXIST)
-       return glnx_throw_errno_prefix (error, "symlinkat");
- 
+-  /* This allows us to support both /boot on a seperate filesystem to / as well
+-   * as on the same filesystem. */
+-  if (TEMP_FAILURE_RETRY (symlinkat (".", sysroot->sysroot_fd, "boot/boot")) < 0)
+-    if (errno != EEXIST)
+-      return glnx_throw_errno_prefix (error, "symlinkat");
+-
 -  g_autofree char *new_target = g_strdup_printf ("loader.%d", new_bootversion);
-+  if (!glnx_opendirat (sysroot->sysroot_fd, "boot", TRUE, &boot_dfd, error))
-+    return FALSE;
- 
+-
 -  /* We shouldn't actually need to replace but it's easier to reuse
 -     that code */
 -  if (!symlink_at_replace (new_target, sysroot->sysroot_fd, "boot/loader.tmp",
 -                           cancellable, error))
++  if (!glnx_opendirat (sysroot->sysroot_fd, "boot", TRUE, &boot_dfd, error))
++    return FALSE;
++
 +  g_autofree char *loader_dir_name = g_strdup_printf ("loader.%d", new_bootversion);
 +
 +  if (!glnx_shutil_mkdir_p_at (boot_dfd, loader_dir_name, 0755,
@@ -131,7 +134,7 @@ index 900efe49..baefaddd 100644
                   GCancellable   *cancellable,
                   GError        **error)
  {
-@@ -2080,11 +2131,8 @@ swap_bootloader (OstreeSysroot  *sysroot,
+@@ -2080,11 +2125,8 @@ swap_bootloader (OstreeSysroot  *sysroot,
    if (!glnx_opendirat (sysroot->sysroot_fd, "boot", TRUE, &boot_dfd, error))
      return FALSE;
  
@@ -145,7 +148,7 @@ index 900efe49..baefaddd 100644
      return FALSE;
  
    /* Now we explicitly fsync this directory, even though it
-@@ -2309,6 +2357,7 @@ write_deployments_bootswap (OstreeSysroot     *self,
+@@ -2309,6 +2351,7 @@ write_deployments_bootswap (OstreeSysroot     *self,
                              OstreeSysrootWriteDeploymentsOpts *opts,
                              OstreeBootloader  *bootloader,
                              SyncStats         *out_syncstats,
@@ -153,7 +156,7 @@ index 900efe49..baefaddd 100644
                              GCancellable      *cancellable,
                              GError           **error)
  {
-@@ -2371,15 +2420,16 @@ write_deployments_bootswap (OstreeSysroot     *self,
+@@ -2371,15 +2414,16 @@ write_deployments_bootswap (OstreeSysroot     *self,
          return glnx_prefix_error (error, "Bootloader write config");
      }
  
@@ -173,7 +176,7 @@ index 900efe49..baefaddd 100644
      return FALSE;
  
    return TRUE;
-@@ -2598,7 +2648,8 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot     *self,
+@@ -2598,7 +2642,8 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot     *self,
  
        /* Note equivalent of try/finally here */
        gboolean success = write_deployments_bootswap (self, new_deployments, opts, bootloader,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]