sysupdate: Compute temporary paths before vacuuming

We don't want to vacuum anything if we're just going to fail just
afterwards because a GPT partition label exceeds the maximum size
so let's compute the temporary paths for all transfers before we do
any vacuuming or acquiring.
This commit is contained in:
Daan De Meyer
2026-02-13 15:46:52 +09:00
committed by Yu Watanabe
parent 09b9466e8c
commit 7b9600a6b2
3 changed files with 39 additions and 26 deletions
+18 -1
View File
@@ -1055,6 +1055,23 @@ static int context_acquire(
log_info("Selected update '%s' for install.", us->version);
_cleanup_free_ InstanceMetadata *metadata = new0(InstanceMetadata, c->n_transfers);
if (!metadata)
return log_oom();
/* Compute up the temporary paths before vacuuming so we don't vacuum anything if we fail to compute
* any paths because of failed validations (e.g. exceeding the gpt partition label size). */
for (size_t i = 0; i < c->n_transfers; i++) {
Instance *inst = us->instances[i];
Transfer *t = c->transfers[i];
assert(inst);
r = transfer_compute_temporary_paths(t, inst, metadata + i);
if (r < 0)
return r;
}
(void) sd_notifyf(/* unset_environment= */ false,
"READY=1\n"
"X_SYSUPDATE_VERSION=%s\n"
@@ -1090,7 +1107,7 @@ static int context_acquire(
continue;
}
r = transfer_acquire_instance(t, inst, context_on_acquire_progress, c);
r = transfer_acquire_instance(t, inst, metadata + i, context_on_acquire_progress, c);
if (r < 0)
return r;
}