Add shutdown check to power button hotplug script

This commit is contained in:
Miguel Fuertes committed 2025-10-16 20:39:13 +02:00
1 parent 94ee025148
commit dfc3b42a24
1 file changed
+9
@@ -1,10 +1,19 @@
#!/bin/sh
# /etc/hotplug.d/button/30_power_update
# Only process power button events
[ "$BUTTON" = "power" ] || exit 0
# Execute update-display on button release
[ "${ACTION}" = "released" ] && {
# Check if system is shutting down
if pgrep poweroff >/dev/null 2>&1 || \
pgrep halt >/dev/null 2>&1 || \
pgrep reboot >/dev/null 2>&1; then
logger -t display "System shutting down - skipping update-display"
exit 0
fi
/usr/sbin/update-display
}