Keep a closed lid from suspending during install and update
shellcheck / shellcheck (push) Successful in 19s

logind ignores sleep locks when the lid closes (LidSwitchIgnoreInhibited),
so install.sh and update now also take a handle-lid-switch lock. It's a
separate systemd-inhibit, since polkit refuses that lock outside a local
session and that mustn't cost the sleep lock too. After a long sleep, a
pacman upgrade can be cut off part way and sudo's cached password expires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-29 21:25:39 -07:00
co-authored by Claude Opus 5.5
parent af853b7d72
commit 06fff0d777
3 changed files with 20 additions and 8 deletions
+3 -1
View File
@@ -65,10 +65,12 @@ ran() {
[ "$status" -eq 0 ]
# In the background, so give it a moment
for _ in 1 2 3 4 5 6 7 8 9 10; do
grep -q '^systemd-inhibit ' "$STUB_LOG" && break
[ "$(grep -c '^systemd-inhibit ' "$STUB_LOG")" -ge 2 ] && break
/usr/bin/sleep 0.1
done
grep -q '^systemd-inhibit --what=sleep:idle .* --mode=block tail --pid=[0-9]* -f /dev/null$' "$STUB_LOG"
# logind ignores sleep locks when the lid closes, so the lid needs its own
grep -q '^systemd-inhibit --what=handle-lid-switch .* --mode=block tail --pid=[0-9]* -f /dev/null$' "$STUB_LOG"
}
@test "update's hooks may upgrade past the pacman guard" {