2023-01-06 10:50:34 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-01-06 13:52:42 -05:00
|
|
|
## Copyright (C) 2023 - 2023 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
|
|
|
|
## Copyright (C) 2023 - 2023 Friedrich Doku <friedrichdoku@gmail.com>
|
2023-01-06 13:47:23 -05:00
|
|
|
## See the file COPYING for copying conditions.
|
2023-01-06 10:50:34 -05:00
|
|
|
|
|
|
|
ram_wipe_check_needshutdown() {
|
|
|
|
local wipe_action
|
|
|
|
wipe_action=$(getarg wiperamaction)
|
|
|
|
|
2023-01-07 14:35:30 -05:00
|
|
|
## TODO: disable
|
2023-01-06 10:50:34 -05:00
|
|
|
wait $(pgrep sdmem)
|
2023-01-07 12:49:18 -05:00
|
|
|
info "wipe-ram.sh wiperamexit: DONE WAITING..."
|
2023-01-06 10:50:34 -05:00
|
|
|
|
|
|
|
if [ "$wipe_action" = "reboot" ]; then
|
2023-01-07 15:35:15 -05:00
|
|
|
info "wipe-ram.sh wiperamexit: reboot..."
|
2023-01-07 16:28:11 -05:00
|
|
|
## Why reboot? Why not just continue to boot?
|
|
|
|
## To get rid of kernel command line options 'wiperamexit=yes wiperamaction=reboot'?
|
2023-01-07 16:34:19 -05:00
|
|
|
## Also RAM wipe using sdmem leads to an OOM and the following error as seen in serial console:
|
2023-01-07 16:34:04 -05:00
|
|
|
## [FAILED] Failed to start dracut pre-udev hook.
|
|
|
|
## In other words, the system might not boot up cleanly.
|
2023-01-07 15:34:20 -05:00
|
|
|
reboot --force
|
2023-01-07 15:35:45 -05:00
|
|
|
elif [ "$wipe_action" = "poweroff" ]; then
|
2023-01-07 15:35:15 -05:00
|
|
|
info "wipe-ram.sh wiperamexit: poweroff..."
|
2023-01-07 15:34:20 -05:00
|
|
|
poweroff --force
|
2023-01-07 15:35:45 -05:00
|
|
|
elif [ "$wipe_action" = "halt" ]; then
|
2023-01-07 15:35:15 -05:00
|
|
|
info "wipe-ram.sh wiperamexit: halt..."
|
2023-01-07 15:34:20 -05:00
|
|
|
halt --force
|
2023-01-07 15:36:36 -05:00
|
|
|
else
|
|
|
|
info "wipe-ram.sh wiperamexit: normal boot..."
|
2023-01-06 10:50:34 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
ram_wipe_check_needshutdown
|