From 55b57c224e3de0bd7c1aceebde91bdda380dbc99 Mon Sep 17 00:00:00 2001 From: veilor-org Date: Sat, 2 May 2026 06:22:47 +0100 Subject: [PATCH] v0.5.3: fix installer require_tty before tee redirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QEMU boot test of v0.5.2 found service still status=1/FAILURE despite file present at /usr/local/bin/veilor-installer. Root cause via `bash -x`: `exec > >(tee -a "$LOG") 2>&1` ran BEFORE require_tty check; process substitution replaces fd1 with a pipe, so [[ -t 1 ]] returns false → require_tty bails out with [ERR] message. Order was self-inflicted bug from v0.5.0. Fix: move require_tty function definition + call BEFORE the tee redirect. Drop the redundant require_tty call in the entry block (would fail post-redirect). --- overlay/usr/local/bin/veilor-installer | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/overlay/usr/local/bin/veilor-installer b/overlay/usr/local/bin/veilor-installer index deb84c7..f534191 100644 --- a/overlay/usr/local/bin/veilor-installer +++ b/overlay/usr/local/bin/veilor-installer @@ -18,6 +18,18 @@ set -uo pipefail export TERM="${TERM:-linux}" LOG=/var/log/veilor-installer.log + +# require_tty MUST run before the tee redirect — process substitution +# replaces fd1 with a pipe, breaking `[[ -t 1 ]]`. +require_tty() { + if ! [[ -t 0 && -t 1 ]]; then + echo "[ERR] veilor-installer must run on a real tty" >&2 + exit 1 + fi +} +require_tty + +# Now safe to tee output for log persistence — tty detection already passed. exec > >(tee -a "$LOG") 2>&1 # ── Branded styling for gum ───────────────────────────────────────────── @@ -64,13 +76,6 @@ EOF fi } -require_tty() { - if ! [[ -t 0 && -t 1 ]]; then - echo "[ERR] veilor-installer must run on a real tty" >&2 - exit 1 - fi -} - # ── TUI wrapper functions ─────────────────────────────────────────────── # Each prompt_* call abstracts gum / whiptail. Always emit the chosen value # on stdout; non-zero exit on cancel/ESC. Callers use `||` to propagate. @@ -562,7 +567,7 @@ launch_desktop() { } # ── Entry ── -require_tty +# (require_tty already called above before exec redirect — see top of file) banner while true; do