emerg-shutdown: fix the hang-on-shutdown bug, add autodetection of new keyboards, shutdown key configuration, and instant shutdown option

This commit is contained in:
Aaron Rainbolt 2025-07-28 20:42:14 -05:00
parent a1d1c56033
commit e42078e90d
No known key found for this signature in database
GPG key ID: A709160D73C79109
5 changed files with 153 additions and 20 deletions

View file

@ -6,9 +6,8 @@ Description=Emergency shutdown when boot media is removed
Documentation=https://github.com/Kicksecure/security-misc
[Service]
Type=oneshot
Type=exec
ExecStart=/usr/libexec/security-misc/emerg-shutdown
RemainAfterExit=true
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,9 @@
SUBSYSTEM!="input", GOTO="end"
# new keyboard or mouse attached or removed, restart emerg-shutdown
KERNEL=="event*", ACTION=="add", ENV{ID_INPUT_KEYBOARD}=="1", RUN+="/usr/bin/systemctl restart emerg-shutdown.service"
KERNEL=="event*", ACTION=="add", ENV{ID_INPUT_KEYBOARD}=="1", GOTO="end"
KERNEL=="event*", ACTION=="remove", ENV{ID_INPUT_KEYBOARD}=="1", RUN+="/usr/bin/systemctl restart emerg-shutdown.service"
KERNEL=="event*", ACTION=="remove", ENV{ID_INPUT_KEYBOARD}=="1", GOTO="end"
LABEL="end"