v0.5.3: fix installer require_tty before tee redirect
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).
This commit is contained in:
parent
ec4291293e
commit
9fedb8592f
1 changed files with 13 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue