Wait for the Linux service launcher to execute its verified binary

This commit is contained in:
2026-11-18 10:27:59 +01:00
parent 17f2e6dc91
commit b8e4b32a33
+5 -1
View File
@@ -172,8 +172,12 @@ def device(args, activate):
replace(UNIT, unit)
run('systemctl', 'daemon-reload')
run('systemctl', 'start', UNIT.name, AGENT)
# The agent unit starts its Python launcher before exec'ing the signed binary.
deadline = time.monotonic() + 15
for service, expected in [(UNIT.name, destination/'helper'), (AGENT, new/'agent')]:
require(process_image(service) == expected, 'Unexpected running binary')
while process_image(service) != expected:
require(time.monotonic() < deadline, f'{service} did not start its verified binary')
time.sleep(0.2)
return dict(binding=binding, version=manifest['version'], previous=[old_hash, source[2]['policy_sha256']],
current=[new_hash, target[2]['policy_sha256']])