Add bash menu and branding
This commit is contained in:
@@ -123,15 +123,39 @@ run_nwipe() {
|
||||
fi
|
||||
}
|
||||
|
||||
run_bash() {
|
||||
local status
|
||||
cd /root
|
||||
if bash --login </dev/tty >/dev/tty 2>&1; then
|
||||
status=0
|
||||
else
|
||||
status=$?
|
||||
fi
|
||||
|
||||
if [ "$status" -ne 0 ]; then
|
||||
printf '\nBash exited with status %s. Returning to the tool menu.\n' "$status"
|
||||
fi
|
||||
}
|
||||
|
||||
show_startup_screen() {
|
||||
if command -v chafa >/dev/null 2>&1 && [ -f /etc/nwipe/logo.jpg ]; then
|
||||
chafa --format symbols --symbols block --colors 16 --size 44x11 \
|
||||
/etc/nwipe/logo.jpg </dev/tty >/dev/tty 2>&1 || true
|
||||
printf '\n' >/dev/tty
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
[ "$(id -u)" -eq 0 ] || { echo 'This tool must run as root.' >&2; exit 1; }
|
||||
show_startup_screen
|
||||
while true; do
|
||||
printf '\nEP ERASER - disk sanitization tools\n===================================\n'
|
||||
printf '1) EP Eraser (device-specific)\n2) nwipe (interactive)\nq) Quit\nChoose a tool: '
|
||||
printf '1) EP Eraser (device-specific)\n2) nwipe (interactive)\n3) Bash shell (root)\nq) Quit\nChoose a tool: '
|
||||
read -r choice
|
||||
case "$choice" in
|
||||
1) run_ep_eraser ;;
|
||||
2) run_nwipe ;;
|
||||
3) run_bash ;;
|
||||
q) exit 0 ;;
|
||||
*) die 'Invalid selection.' ;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user