boot: Add ostree-finalize-staged.path

Rather than manually starting the `ostree-finalize-staged.service` unit,
we can leverage systemd's path units for this. It fits quite nicely too,
given that we already have a path we drop iif we have a staged
deployment.

To give some time for the preset to make it to systems, we don't yet
drop the explicit call to `systemctl start`. Though we do make it
conditional based on a DEBUG env var so that we can actually test it in
CI for now. Once we're sure this has propagated, we can drop the
`systemctl start` path and the env var together.

Closes: #1740
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon authored and Atomic Bot committed 2018-10-23 13:10:49 +00:00
1 parent 1e16aec357
commit ac1a919ffd
6 files changed
+61 -2

No files matched your search

+9
View File
@@ -2761,6 +2761,10 @@ ostree_sysroot_stage_tree (OstreeSysroot *self,
if (booted_deployment == NULL)
return glnx_throw (error, "Cannot stage a deployment when not currently booted into an OSTree system");
/* This is used by the testsuite to exercise the path unit, until it becomes the default
* (which is pending on the preset making it everywhere). */
if ((self->debug_flags & OSTREE_SYSROOT_DEBUG_TEST_STAGED_PATH) == 0)
{
/* This is a bit of a hack. When adding a new service we have to end up getting
* into the presets for downstream distros; see e.g. https://src.fedoraproject.org/rpms/ostree/pull-request/7
*
@@ -2773,6 +2777,11 @@ ostree_sysroot_stage_tree (OstreeSysroot *self,
return FALSE;
if (!g_spawn_check_exit_status (estatus, error))
return FALSE;
}
else
{
g_print ("test-staged-path: Not running `systemctl start`\n");
} /* OSTREE_SYSROOT_DEBUG_TEST_STAGED_PATH */
g_autoptr(OstreeDeployment) deployment = NULL;
if (!sysroot_initialize_deployment (self, osname, revision, origin, override_kernel_argv,