Keep a closed lid from suspending during install and update
shellcheck / shellcheck (push) Successful in 19s
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:
+3
-1
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user