power: the sleep hooks are wanted by the sleep targets, not declared as services

The host reads a one-shot that is not running as having run, so a before-sleep or after-wake unit
declared stopped failed on its first apply; drop-ins on the sleep targets pull them in instead.
This commit is contained in:
jochen
2026-10-04 17:22:35 +02:00
parent fee36954e5
commit ac1a6fca38
3 changed files with 78 additions and 17 deletions
+4 -1
View File
@@ -32,8 +32,11 @@ func (m *Machine) Check(ctx context.Context, w *Watcher) map[string]any {
enabled, _ := m.Run(ctx, "systemctl", "is-enabled", u)
enabled = strings.TrimSpace(enabled)
want := "enabled"
if u == "mesh-power-supply.service" {
switch u {
case "mesh-power-supply.service":
want = "static" // started by the udev rule, never by a target
case "mesh-power-before-sleep.service", "mesh-power-after-wake.service":
want = "static" // wanted by the sleep targets through the module's drop-ins, never enabled
}
add(u, present && enabled == want, "%s: file present %v, %s (want %s)", Units[u], present, orWord(enabled, "unknown"), want)
}