postprocess: Silently clean up known-unnecessary files in /var
Per OSTree design, /var can start out empty. However, our warning spam here is annoying. Let's first delete some known files - obviously this won't be exhaustive, but it's way faster than trying to fix all of this in the packages right now. The major one is the SELinux policy, which resulted in a lot of spam. Closes: #473 Approved by: jlebon
This commit is contained in:
parent
80267a423a
commit
0cd584ccf6
@ -650,7 +650,37 @@ convert_var_to_tmpfiles_d (int src_rootfs_dfd,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GString) prefix = g_string_new ("/var");
|
||||
glnx_fd_close int var_dfd = -1;
|
||||
glnx_fd_close int tmpfiles_fd = -1;
|
||||
/* List of files that shouldn't be in the tree */
|
||||
const char *known_state_files[] = {
|
||||
"lib/systemd/random-seed",
|
||||
"lib/systemd/catalog/database",
|
||||
"lib/plymouth/boot-duration",
|
||||
};
|
||||
|
||||
if (!glnx_opendirat (src_rootfs_dfd, "var", TRUE, &var_dfd, error))
|
||||
goto out;
|
||||
|
||||
/* Here, delete some files ahead of time to avoid emitting warnings
|
||||
* for things that are known to be harmless.
|
||||
*/
|
||||
for (guint i = 0; i < G_N_ELEMENTS (known_state_files); i++)
|
||||
{
|
||||
const char *path = known_state_files[i];
|
||||
if (unlinkat (var_dfd, path, 0) < 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now, SELinux in Fedora >= 24: https://bugzilla.redhat.com/show_bug.cgi?id=1290659 */
|
||||
if (!glnx_shutil_rm_rf_at (var_dfd, "lib/selinux/targeted", cancellable, error))
|
||||
goto out;
|
||||
|
||||
/* Append to an existing one for package layering */
|
||||
if ((tmpfiles_fd = TEMP_FAILURE_RETRY (openat (dest_rootfs_dfd, "usr/lib/tmpfiles.d/rpm-ostree-1-autovar.conf",
|
||||
|
Loading…
Reference in New Issue
Block a user