lib/deploy: Fix staged deployments with no kargs

Testing out the staged API with rpm-ostree, ostree-prepare-root.service
in the initramfs was failing.  Turned out that was because we didn't
have a `root=` kernel argument.  Which was because we didn't have
any kernel arguments at all except `ostree=`.

That in turn was because we weren't loading the bootloader config
from the merge deployment.

The serialized deployment data holds the unique identity of
(osname, checksum, deployserial) - look for the real merge deployment
in our deployment list which has the bootloader arguments we need.

This issue was entirely masked by the `ostree admin deploy` command
which itself explicitly loads the merge deployment's kernel arguments
in every case - it never passes the `NULL` default down.  A followup
patch will fix that.
This commit is contained in:
Colin Walters 2018-04-27 11:53:43 -04:00
parent dc4aa346a3
commit cadece6c4f

View File

@ -2759,10 +2759,24 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self,
if (g_variant_lookup (self->staged_deployment_data, "merge-deployment", "@a{sv}",
&merge_deployment_v))
{
merge_deployment =
g_autoptr(OstreeDeployment) merge_deployment_stub =
_ostree_sysroot_deserialize_deployment_from_variant (merge_deployment_v, error);
if (!merge_deployment)
if (!merge_deployment_stub)
return FALSE;
for (guint i = 0; i < self->deployments->len; i++)
{
OstreeDeployment *deployment = self->deployments->pdata[i];
if (ostree_deployment_equal (deployment, merge_deployment_stub))
{
merge_deployment = g_object_ref (deployment);
break;
}
}
if (!merge_deployment)
return glnx_throw (error, "Failed to find merge deployment %s.%d for staged",
ostree_deployment_get_csum (merge_deployment_stub),
ostree_deployment_get_deployserial (merge_deployment_stub));
}
g_autofree char **kargs = NULL;
g_variant_lookup (self->staged_deployment_data, "kargs", "^a&s", &kargs);