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:
+7
-3
@@ -83,10 +83,14 @@ on_exit() {
|
||||
trap on_exit EXIT
|
||||
|
||||
# Keep the computer from suspending, from idle or a closed lid, until the
|
||||
# install exits. tail exits with it, and that ends the inhibitor.
|
||||
# install exits. logind ignores sleep locks when the lid closes, so the lid
|
||||
# takes its own lock, kept apart since polkit refuses it outside a local
|
||||
# session. tail exits with the install, and that ends the inhibitors.
|
||||
if command -v systemd-inhibit > /dev/null; then
|
||||
systemd-inhibit --what=sleep:idle --who=CoreDesktop --why="Installing CoreDesktop" --mode=block \
|
||||
tail --pid=$$ -f /dev/null > /dev/null 2>&1 &
|
||||
for what in sleep:idle handle-lid-switch; do
|
||||
systemd-inhibit --what="$what" --who=CoreDesktop --why="Installing CoreDesktop" --mode=block \
|
||||
tail --pid=$$ -f /dev/null > /dev/null 2>&1 &
|
||||
done
|
||||
fi
|
||||
|
||||
# Lets the install's pacman upgrade the system past the guard that stops
|
||||
|
||||
Reference in New Issue
Block a user