v0.5.26: log to /run, tolerate tee failure

User hit `/usr/local/bin/veilor-installer: line 33: /usr/bin/tee:
input/output error` on real-hardware install. Cause: LOG was
`/var/log/veilor-installer.log`, which on the live ISO is backed by an
overlay over squashfs. A bad sector / flaky USB → tee write fails →
process substitution dies → installer aborts before the menu renders.

Two changes:

1. Move LOG to /run/veilor-installer.log — pure tmpfs, never touches
   the live medium. Same path also unaffected by /var fill or overlay
   weirdness.

2. Wrap the `exec > >(tee -a $LOG) 2>&1` redirect in a writability
   probe. If the log can't be appended to (tmpfs OOM, fd exhaustion,
   anything), skip the tee and run the installer without on-disk
   persistence rather than crashing.

Persistence is a nice-to-have for post-mortem debugging; the installer
running is the must-have. This inverts the priority correctly.
This commit is contained in:
veilor-org 2026-05-04 14:20:26 +01:00
parent b3509b4b06
commit c89c73ee84

View file

@ -17,7 +17,10 @@
set -uo pipefail set -uo pipefail
export TERM="${TERM:-linux}" export TERM="${TERM:-linux}"
LOG=/var/log/veilor-installer.log # Log to /run (pure tmpfs) — /var/log overlays squashfs on the live ISO, so a
# bad sector on the USB medium turns `tee -a` into "input/output error" and
# kills the installer before the menu can render.
LOG=/run/veilor-installer.log
# require_tty MUST run before the tee redirect — process substitution # require_tty MUST run before the tee redirect — process substitution
# replaces fd1 with a pipe, breaking `[[ -t 1 ]]`. # replaces fd1 with a pipe, breaking `[[ -t 1 ]]`.
@ -29,8 +32,12 @@ require_tty() {
} }
require_tty require_tty
# Now safe to tee output for log persistence — tty detection already passed. # Tee output for log persistence, but only if LOG is writable. On a flaky USB
exec > >(tee -a "$LOG") 2>&1 # the squashfs/overlay can throw I/O errors mid-write — tolerate that and
# keep the installer running without persistence rather than aborting.
if : >> "$LOG" 2>/dev/null; then
exec > >(tee -a "$LOG") 2>&1
fi
# ── Branded styling for gum ───────────────────────────────────────────── # ── Branded styling for gum ─────────────────────────────────────────────
# colors.gum sets GUM_* env vars — pure-black palette from veilor-black KDE. # colors.gum sets GUM_* env vars — pure-black palette from veilor-black KDE.