compose: Add environment variable to skip tmpdir cleanup

This was useful for me to directly invoke bwrap against the target
rootfs.

Part of working on: https://github.com/projectatomic/rpm-ostree/issues/1329

Closes: #1333
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-04-09 14:32:42 -04:00 committed by Atomic Bot
parent e38c64c330
commit abcaf42d55

View File

@ -139,7 +139,10 @@ rpm_ostree_tree_compose_context_free (RpmOstreeTreeComposeContext *ctx)
/* Only close workdir_dfd if it's not owned by the tmpdir */
if (!ctx->workdir_tmp.initialized)
glnx_close_fd (&ctx->workdir_dfd);
(void)glnx_tmpdir_delete (&ctx->workdir_tmp, NULL, NULL);
if (g_getenv ("RPMOSTREE_PRESERVE_TMPDIR"))
g_print ("Preserved workdir: %s\n", ctx->workdir_tmp.path);
else
(void)glnx_tmpdir_delete (&ctx->workdir_tmp, NULL, NULL);
glnx_close_fd (&ctx->rootfs_dfd);
glnx_close_fd (&ctx->cachedir_dfd);
g_clear_object (&ctx->repo);