summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2014-07-10 15:19:50 -0400
committerColin Walters <walters@verbum.org>2014-09-13 10:43:14 -0400
commit12e3ed83d3ab7dc8077872f1319a4d7deb0ae81f (patch)
treec8ba174554f3474957f8b3451f169e3e90f5d336
parent7b01bd2e4333d4346dd08e0b5caf672f56b1ccfd (diff)
downloadostree-12e3ed83d3ab7dc8077872f1319a4d7deb0ae81f.tar.gz
deploy: Clean up leftover state before creating new directories
This fixes a regression introduced with https://git.gnome.org/browse/ostree/commit/?id=7baa600e237b326899de2899a9bc54a6b863943c The original code in "ostree admin upgrade" had a comment: /* Here we perform cleanup of any leftover data from previous * partial failures. This avoids having to call gs_shutil_rm_rf() * at random points throughout the process. */ But since I deleted that initial cleanup call, we *do* need to do the cleanup during the process run. It turns out there are only a few places this is necessary. https://bugzilla.gnome.org/show_bug.cgi?id=733030
-rw-r--r--src/libostree/ostree-sysroot-deploy.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index a6f1fc09..15eb9007 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -1072,6 +1072,9 @@ swap_bootlinks (OstreeSysroot *self,
ostree_subbootdir_name = g_strdup_printf ("boot.%d.%d", bootversion, new_subbootversion);
ostree_subbootdir = g_file_resolve_relative_path (ostree_dir, ostree_subbootdir_name);
+ if (!gs_shutil_rm_rf (ostree_subbootdir, cancellable, error))
+ goto out;
+
if (!ot_util_ensure_directory_and_fsync (ostree_subbootdir, cancellable, error))
goto out;
@@ -1526,6 +1529,8 @@ ostree_sysroot_write_deployments (OstreeSysroot *self,
new_loader_entries_dir = ot_gfile_resolve_path_printf (self->path, "boot/loader.%d/entries",
new_bootversion);
+ if (!gs_shutil_rm_rf (new_loader_entries_dir, cancellable, error))
+ goto out;
if (!ot_util_ensure_directory_and_fsync (new_loader_entries_dir, cancellable, error))
goto out;