sysupdate: notify hook subscribers after a successful update

Define a new io.systemd.SysUpdate.Notify Varlink interface with a single
OnCompletedUpdate() method, and after sysupdate successfully installs an
update, invoke that method on every socket linked into
/run/systemd/sysupdate/notify/ via varlink_execute_directory(). This
gives other components a hook to react to applied updates (e.g. recompute
a TPM policy, link a freshly downloaded kernel, refresh extensions).

The notification carries the component name, the installed version and the
list of updated resources (transfer id + on-disk path). Subscribers are
free to ignore the parameters and just treat the call as a trigger.

Setting SYSTEMD_SYSUPDATE_FORCE_NOTIFY=1 forces the notification to be sent
even when no update was applied (in which case no resource list is included),
so follow-up work can be triggered unconditionally.

Fixes: #35988
This commit is contained in:
Lennart Poettering
2026-06-24 13:05:33 +02:00
parent 95a372a514
commit d36bdc9467
7 changed files with 132 additions and 0 deletions
+7
View File
@@ -870,3 +870,10 @@ Tools using the Varlink protocol (such as `varlinkctl`) or sd-bus (such as
'freshness' check via `BEST-BEFORE-YYYY-MM-DD` files in `SHA256SUMS` manifest
files is disabled, and updating from outdated manifests will not result in an
error.
* `$SYSTEMD_SYSUPDATE_FORCE_NOTIFY` – takes a boolean. If true the notification
callouts in `/run/systemd/sysupdate/notify/` are invoked even when no update
was applied (i.e. the system was already up-to-date). In this case the
notification carries no list of updated resources. This is useful to
unconditionally trigger follow-up work such as relinking a kernel or
recomputing a TPM policy.