compose: Write a preset file to enable ostree-remount.service

I've lost count now of how many times people have hit variants
of https://github.com/projectatomic/centos-release-atomic-host-devel/pull/6
Let's just bake it in.

Closes: #1482
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-07-31 16:00:55 -04:00 committed by Atomic Bot
parent 628a3aa22f
commit 23badcd288
2 changed files with 19 additions and 0 deletions

View File

@ -992,6 +992,22 @@ rpmostree_postprocess_final (int rootfs_dfd,
return glnx_prefix_error (error, "SELinux postprocess");
}
/* We keep hitting issues with the ostree-remount preset not being
* enabled; let's just do this rather than trying to propagate the
* preset everywhere.
*/
static const char preset_dir[] = "usr/lib/systemd/system-preset";
if (!glnx_shutil_mkdir_p_at (rootfs_dfd, preset_dir, 0755, cancellable, error))
return FALSE;
{ g_autofree char *preset_path = g_build_filename (preset_dir, "40-rpm-ostree-auto.preset", NULL);
static const char remount_preset[] = "# Written by rpm-ostree compose tree\nenable ostree-remount.service\n";
if (!glnx_file_replace_contents_at (rootfs_dfd, preset_path, (guint8*)remount_preset,
strlen (remount_preset),
GLNX_FILE_REPLACE_NODATASYNC,
cancellable, error))
return FALSE;
}
if (!convert_var_to_tmpfiles_d (rootfs_dfd, cancellable, error))
return FALSE;

View File

@ -30,6 +30,9 @@ assert_file_has_content_literal autovar.txt 'd /var/cache 0755 root root - -'
assert_file_has_content_literal autovar.txt 'd /var/log/chrony 0755 chrony chrony - -'
echo "ok autovar"
ostree --repo=${repobuild} cat ${treeref} /usr/lib/systemd/system-preset/40-rpm-ostree-auto.preset > preset.txt
assert_file_has_content preset.txt '^enable ostree-remount.service$'
if ! rpm-ostree --version | grep -q rust; then
echo "ok yaml (SKIP)"
else