Keep the inhibit-delay check alive when there is nothing to check

Migrations run under bash -euo pipefail, where an assignment from a failed
command substitution ends the script. Reading InhibitDelayMaxSec out of a
drop-in that is not there exits sed 2, so the migration died at exactly the
condition it was written to detect: instead of flagging reboot-required, it
aborted before reaching the flag. The busctl read had the same shape, with
pipefail standing in for the failed substitution.

An aborted migration is never marked complete and takes omarchy-migrate's own
-e down with it, so the two migrations queued behind this one stopped running
as well.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-26 14:37:22 -07:00
co-authored by Claude Opus 5
parent 187c2ecf7f
commit 9ec7916c0b
+5 -2
View File
@@ -12,10 +12,13 @@ sudo systemctl reload systemd-logind >/dev/null 2>&1 || true
# the old five second window in place. omarchy-system-sleep-lock reads this same
# property at runtime, so it stays correct either way -- the reboot flag is only
# about getting the wider window to take effect.
#
# Both reads have to survive failing: a missing drop-in or an unreachable logind
# is the very condition being tested for, and migrations run under -e.
dropin=/etc/systemd/logind.conf.d/20-inhibit-delay.conf
expected_s=$(sed -n 's/^InhibitDelayMaxSec=//p' "$dropin" 2>/dev/null)
expected_s=$(sed -n 's/^InhibitDelayMaxSec=//p' "$dropin" 2>/dev/null || true)
effective_us=$(busctl get-property org.freedesktop.login1 /org/freedesktop/login1 \
org.freedesktop.login1.Manager InhibitDelayMaxUSec 2>/dev/null | awk '{print $2}')
org.freedesktop.login1.Manager InhibitDelayMaxUSec 2>/dev/null | awk '{print $2}' || true)
if [[ -z $expected_s || $effective_us != $((expected_s * 1000000)) ]]; then
omarchy-state set reboot-required