diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 227fdd24..82f864cb 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1540,6 +1540,7 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot, OstreeDeployment *booted_deployment = NULL; g_autoptr(GPtrArray) deployments = NULL; g_autoptr(GPtrArray) new_deployments = g_ptr_array_new_with_free_func (g_object_unref); + const gboolean postclean = (flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN) == 0; gboolean retain = (flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN) > 0; const gboolean make_default = !((flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT) > 0); gboolean added_new = FALSE; @@ -1593,8 +1594,11 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot, if (!ostree_sysroot_write_deployments (sysroot, new_deployments, cancellable, error)) goto out; - if (!ostree_sysroot_cleanup (sysroot, cancellable, error)) - goto out; + if (postclean) + { + if (!ostree_sysroot_cleanup (sysroot, cancellable, error)) + goto out; + } ret = TRUE; out: diff --git a/src/libostree/ostree-sysroot.h b/src/libostree/ostree-sysroot.h index 1e60ddbe..1e98cc10 100644 --- a/src/libostree/ostree-sysroot.h +++ b/src/libostree/ostree-sysroot.h @@ -182,7 +182,8 @@ GKeyFile *ostree_sysroot_origin_new_from_refspec (OstreeSysroot *self, typedef enum { OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE = 0, OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN = (1 << 0), - OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT = (1 << 1) + OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT = (1 << 1), + OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN = (1 << 2), } OstreeSysrootSimpleWriteDeploymentFlags; _OSTREE_PUBLIC