Quiet dnf transactions: spinner + one-line summary, log on failure

ui_quiet_run wraps every install_packages/install_optional/group
install/remove and the system update: while gum is available and the
run is interactive, dnf output is hidden behind a spinner, then a
single 'Installing: <pkgs> (N packages)' line. Full output is appended
to $SETUP_DNF_LOG (/tmp/fedora-setup-dnf-<uid>.log); on failure the
last 20 lines print in red so nothing is lost. Unattended and no-gum
runs keep plain full output (logs/cron contract).

Also: fallback ui_choose accepts 'x' to exit (muscle memory from the
old menu), fixed a stray stdout newline leaking into captured answers
(same class as the earlier '\nno' bug), fixed pluralization.

Harness: piped fallback, pty gum run incl. a failing VirtualBox pick
(red failure + log tail, menu survives, subsequent qemu install ok),
unattended regression.
This commit is contained in:
Pathfinder
2026-10-27 19:20:31 +01:00
parent c6e41cbf1e
commit 9dd1ecada8
3 changed files with 63 additions and 19 deletions
+6 -2
View File
@@ -13,6 +13,10 @@ source "$SCRIPT_DIR/lib/session.sh"
# shellcheck source=lib/ui.sh
source "$SCRIPT_DIR/lib/ui.sh"
# Full dnf output from quiet transactions lands here (shown on failure).
export SETUP_DNF_LOG="${SETUP_DNF_LOG:-/tmp/fedora-setup-dnf-$(id -u).log}"
: >> "$SETUP_DNF_LOG"
#------------------------------------------
# Defaults + argument parsing
# DEBUG_MODE must be initialised before anything reads it under set -u.
@@ -185,8 +189,8 @@ fi
info "Ensuring Flathub is available (system-wide)..."
sudo flatpak remote-add --if-not-exists --system flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Update the system (spinner when gum is present; output shown on failure)
ui_run "Updating the system" sudo dnf update -y
# Update the system (spinner + one-line summary; full output in $SETUP_DNF_LOG)
ui_quiet_run "Updating the system" sudo dnf update -y
pause_if_debug
#------------------------------------------