mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-08-09 03:22:19 -04:00
Add emergency shutdown feature, triggered by root device removal
This commit is contained in:
parent
341dce33fb
commit
f3d46ee562
5 changed files with 337 additions and 0 deletions
24
usr/libexec/security-misc/force-poweroff-on-boot-media-removal
Executable file
24
usr/libexec/security-misc/force-poweroff-on-boot-media-removal
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2025 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
|
||||
# See the file COPYING for copying conditions.
|
||||
|
||||
gcc \
|
||||
-o \
|
||||
/run/force-shutdown-when-device-removed \
|
||||
-static \
|
||||
/usr/src/security-misc/force-shutdown-when-device-removed.c \
|
||||
|| {
|
||||
printf "%s\n" 'Could not compile force-shutdown executable!'
|
||||
exit 1;
|
||||
}
|
||||
|
||||
readarray -t root_devices < <(/usr/libexec/helper-scripts/get-backing-devices-for-mountpoint '/');
|
||||
|
||||
## memlockd daemonizes itself, so no need to background it
|
||||
memlockd -c /usr/share/security-misc/security-misc-memlockd.cfg
|
||||
|
||||
/run/force-shutdown-when-device-removed "${root_devices}" &
|
||||
sleep 1
|
||||
disown
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue