4 Commits

Author SHA1 Message Date
c1bc79efd8 Fix crash when viewing snapshots (and other list views)
Root cause: under `set -euo pipefail`, the view functions built their body
with `body="$(zfs ... | awk ...)"`. If the pipeline exited non-zero — either
because `zfs list -t snapshot` returned non-zero (e.g. the no-snapshots case)
or because the large report was handed to `whiptail --msgbox` as one argv
string and newt choked — `set -e` aborted the entire script, dropping the
whole TUI back to the shell. The snapshot view is the most exposed since it is
both the largest body and the most likely to hit a non-zero zfs result.

Fix: route every list view through a hardened show() that runs the report
producer with `set -e` disabled (so an inner non-zero can never kill the TUI)
and renders via `whiptail --textbox <tmpfile>` (reads from a file instead of
taking the report as an argv string, and scrolls large content cleanly). Each
view_* is now a thin wrapper over a _report_* producer that prints to stdout.

Verified with a stubbed harness: failing pipeline, 5000-row list, and a
non-zero whiptail all now survive; the previous pattern crashed (exit 1).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 13:34:54 +08:00
936db8b5ff Rewrite as menuconfig-style whiptail bash TUI
Replace the Python Textual app (tui.py) with zfs-snapshot.sh, a single-file
whiptail TUI matching the house style of the sibling scripts in this folder
(sudo re-exec header, msg/yesno/run_and_show helpers, action functions, a
menuconfig-style main menu).

Keeps all prior functionality:
  - Snapshots: list / create / delete / rollback
  - Schedules: cron auto-snapshots with auto-prune (keep last N) + snapshot-now
  - Datasets: usage view
  - LXC Mounts: pct bind-mountpoint add/remove (hidden when pct is absent)
  - Replication: full/incremental zfs send | recv
  - Scrub: start / stop / schedule per pool

Cron entries are kept in a single owner file (/etc/cron.d/pve-zfs-tui);
helper scripts are generated on demand. README rewritten to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 13:26:57 +08:00
root
5eb7572fa1 Move cron management to /etc/cron.d/pve-tui
Stop mutating root's crontab. All snapshot and scrub schedules now live
in a single TUI-owned file at /etc/cron.d/pve-tui, with a one-shot
migrate_legacy_crontab() that extracts pre-existing pve-tui blocks from
the crontab on startup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 23:09:05 +08:00
root
946caeff90 Initial commit: PVE Storage Manager TUI 2026-04-27 22:56:14 +08:00