Add screen and tmux fix menu exit behavior

This commit is contained in:
2026-10-01 20:35:53 +03:00
parent 56224b8e38
commit 1938705e00
4 changed files with 74 additions and 10 deletions
+4 -2
View File
@@ -23,6 +23,8 @@ sudo ./build.sh
The output is `build/ep-eraser-amd64.hybrid.iso`. Write it to a USB drive with a tool such as Rufus or `dd`. Verify the output checksum before deployment.
The GRUB boot menu waits 5 seconds before starting the live system.
To build without installing packages on the host, use Docker from Linux or WSL:
```sh
@@ -56,9 +58,9 @@ To build the OVA in Docker, use `docker run --rm -v "$PWD:/work" --entrypoint /w
Boot the target machine from the image, inspect the disk list, and choose the exact device path. The program detects rotational media and presents the appropriate operation. Reboot after completion; do not remove the USB device until the result is shown.
Choose `nwipe` from the startup menu to use its interactive interface. Its PDF certificates are saved under `/var/log/ep-eraser/reports`; copy them to persistent storage before rebooting because the live system's filesystem is temporary. Press `c` in nwipe to edit certificate details such as company, customer, and host information. Those settings are also temporary unless included in the image.
Choose **Programs** from the startup menu to open `nwipe` or a root Bash shell. `tmux` and `screen` are installed for use from Bash. Nwipe's PDF certificates are saved under `/var/log/ep-eraser/reports`; copy them to persistent storage before rebooting because the live system's filesystem is temporary. Press `c` in nwipe to edit certificate details such as company, customer, and host information. Those settings are also temporary unless included in the image.
The supplied `config/includes.chroot/etc/nwipe/eternity-project-logo.svg` is converted to `logo.jpg` during image preparation for nwipe PDF certificates. The same logo is rendered as a colored startup screen above the tty1 menu. Nwipe is built from upstream v0.42 and uses `/etc/nwipe/logo.jpg` for PDF branding. You can include `/etc/nwipe/nwipe.conf` in `config/includes.chroot` to ship default certificate settings.
The supplied `config/includes.chroot/etc/nwipe/eternity-project-logo.svg` has a generated `logo.jpg` alongside it for nwipe PDF certificates. The same JPEG is rendered as a colored startup screen above the tty1 menu. Nwipe is built from upstream v0.42 and uses `/etc/nwipe/logo.jpg` for PDF branding. You can include `/etc/nwipe/nwipe.conf` in `config/includes.chroot` to ship default certificate settings.
NetworkManager provides network connectivity; wired Ethernet uses DHCP automatically, and Wi-Fi can be configured with `nmcli device wifi list` followed by `nmcli device wifi connect "SSID" --ask`. The image starts SSH and Telnet servers for the `eraser` account with password `eperaser`; root SSH login is disabled. The account can run only the EP Eraser and nwipe programs through passwordless `sudo`, for example `sudo -n /usr/local/sbin/ep-eraser` or `sudo -n /usr/local/bin/nwipe`.
+31
View File
@@ -0,0 +1,31 @@
set default=0
set timeout=5
set timeout_style=menu
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
font=$prefix/unicode.pf2
fi
if loadfont $font ; then
set gfxmode=800x600
set gfxpayload=keep
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
else
set gfxmode=auto
insmod all_video
fi
insmod gfxterm
insmod png
source /boot/grub/theme.cfg
terminal_output gfxterm
insmod play
play 960 440 1 0 4 440 1
@@ -31,7 +31,7 @@ choose_disk() {
disk_info | nl -w2 -s' '
printf '\nEnter the number shown above, or q to quit: '
read -r choice
[ "$choice" = q ] && exit 0
[ "$choice" = q ] && return 2
[[ "$choice" =~ ^[0-9]+$ ]] || { die 'Invalid selection.'; return 1; }
target=${disks[$((choice - 1))]:-}
[ -n "$target" ] || { die 'Invalid selection.'; return 1; }
@@ -83,8 +83,15 @@ verify() {
}
run_ep_eraser() {
local selection_status
while true; do
choose_disk || continue
if choose_disk; then
:
else
selection_status=$?
[ "$selection_status" -eq 2 ] && return 0
continue
fi
validate_target || continue
rotational=$(lsblk -dnro ROTA "$target")
if [ "$rotational" = 1 ]; then
@@ -94,11 +101,19 @@ run_ep_eraser() {
fi
printf '\nDetected media type: %s\n' "$operation"
confirm || continue
if [ "$operation" = HDD ]; then erase_hdd; else erase_ssd; fi
if [ "$operation" = HDD ]; then
if ! erase_hdd; then
printf '\nHDD erase failed or was interrupted. Returning to the disk menu.\n'
continue
fi
elif ! erase_ssd; then
printf '\nSSD/NVMe erase failed or was interrupted. Returning to the disk menu.\n'
continue
fi
verify
printf '\nPress Enter to return to the disk menu, or type q to quit: '
read -r answer
[ "$answer" = q ] && exit 0
[ "$answer" = q ] && return 0
done
}
@@ -137,6 +152,21 @@ run_bash() {
fi
}
run_programs() {
while true; do
printf '\nPrograms\n========\n'
printf '1) nwipe\n2) Bash shell (root)\nb) Back\nq) Quit\nChoose a program: '
read -r choice
case "$choice" in
1) run_nwipe ;;
2) run_bash ;;
b) return ;;
q) return ;;
*) die 'Invalid selection.' ;;
esac
done
}
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 \
@@ -149,13 +179,12 @@ 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)\n3) Bash shell (root)\nq) Quit\nChoose a tool: '
printf '\nEP ERASER\n=========\n'
printf '1) EP Eraser\n2) Programs\nq) Quit\nChoose: '
read -r choice
case "$choice" in
1) run_ep_eraser ;;
2) run_nwipe ;;
3) run_bash ;;
2) run_programs ;;
q) exit 0 ;;
*) die 'Invalid selection.' ;;
esac
@@ -15,7 +15,9 @@ openssh-server
openbsd-inetd
parted
smartmontools
screen
sudo
tmux
util-linux
wireless-regdb
wpasupplicant