postprocess: Unlink our treecompose-post out of the final /bin

Another variant of <https://github.com/projectatomic/rpm-ostree/pull/822> 😭

Closes: #964
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-08-30 16:24:54 -04:00 committed by Atomic Bot
parent 3047513509
commit 213a656ddf
2 changed files with 11 additions and 1 deletions

View File

@ -1443,7 +1443,9 @@ rpmostree_treefile_postprocessing (int rootfs_fd,
/* Clone all the things */
/* Note we need to make binpath *not* absolute here */
if (!glnx_file_copy_at (AT_FDCWD, src, NULL, rootfs_fd, binpath + 1,
const char *target_binpath = binpath + 1;
g_assert_cmpint (*target_binpath, !=, '/');
if (!glnx_file_copy_at (AT_FDCWD, src, NULL, rootfs_fd, target_binpath,
GLNX_FILE_COPY_NOXATTRS, cancellable, error))
return FALSE;
@ -1455,6 +1457,9 @@ rpmostree_treefile_postprocessing (int rootfs_fd,
return glnx_prefix_error (error, "While executing postprocessing script '%s'", bn);
}
if (unlinkat (rootfs_fd, target_binpath, 0) < 0)
return glnx_throw_errno_prefix (error, "unlinkat(%s)", target_binpath);
g_print ("Finished postprocessing script '%s'\n", bn);
}

View File

@ -30,4 +30,9 @@ assert_file_has_content out.txt 'Thu Jan 1 00:00:00 UTC 1970'
ostree --repo=${repobuild} cat ${treeref} /usr/etc/lang-test.de.touch.txt > out.txt
assert_file_has_content out.txt 'missing file operand'
if ostree --repo=${repobuild} ls ${treeref} /usr/bin/rpmostree-postprocess-lang-test.sh 2>err.txt; then
assert_not_reached "we failed to unlink?"
fi
assert_file_has_content err.txt "error: No such file or directory"
echo "ok install-langs"