security-misc/usr/lib/dracut/modules.d/10ram-wipe-exit/wipe-ram-needshutdown.sh
Patrick Schleizer d8bf40f7a2
refactoring
2023-01-07 15:35:45 -05:00

34 lines
948 B
Bash
Executable File

#!/bin/sh
## Copyright (C) 2023 - 2023 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## Copyright (C) 2023 - 2023 Friedrich Doku <friedrichdoku@gmail.com>
## See the file COPYING for copying conditions.
ram_wipe_check_needshutdown() {
local wipe_action
wipe_action=$(getarg wiperamaction)
## TODO: disable
wait $(pgrep sdmem)
info "wipe-ram.sh wiperamexit: DONE WAITING..."
if [ "$wipe_action" = "reboot" ]; then
info "wipe-ram.sh wiperamexit: reboot..."
reboot --force
elif [ "$wipe_action" = "poweroff" ]; then
info "wipe-ram.sh wiperamexit: poweroff..."
poweroff --force
elif [ "$wipe_action" = "halt" ]; then
info "wipe-ram.sh wiperamexit: halt..."
halt --force
fi
if [ "$wipe_action" = "error" ]; then
info "wipe-ram.sh wiperamexit: Choice of shutdown option led to an error. Shutting down..."
sleep 5
poweroff --force
fi
}
ram_wipe_check_needshutdown