From 169c900805b1f6fc65e9b938f1834f931414ac24 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Tue, 13 Oct 2026 07:36:11 +0000 Subject: [PATCH] fix(install): prompt via /dev/tty so 'curl | bash' is interactive - prompts (location, OpenCode activation, web UI service, collision strategy) now read from the controlling terminal, not stdin - have_tty()/tty_read() helpers; all read sites routed through tty_read - previously 'curl | bash' had no TTY on stdin, so every prompt was silently skipped - README: note the one-liner is interactive (and falls back to safe defaults in CI) --- README.md | 2 ++ install.sh | 52 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f2df2e5..ed17adc 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,8 @@ The installer is **all-in-one**: if OpenCode isn't already installed, it bootstr curl -fsSL https://git.lohmar.co.uk/cclohmar/NewOpenAgents/raw/branch/main/install.sh | bash ``` +Even though the script arrives over a pipe, it is **interactive**: it reads your answers from the terminal (`/dev/tty`). In a non-terminal context (CI), it runs with safe defaults instead of prompting. + ### Or clone, then install (recommended for updates) ```bash diff --git a/install.sh b/install.sh index a796435..b2713f0 100755 --- a/install.sh +++ b/install.sh @@ -71,6 +71,24 @@ error() { printf "${RED}✗${NC} %s\n" "$1" >&2; } step() { printf "\n${MAGENTA}${BOLD}▶${NC} %s\n\n" "$1"; } die() { error "$1"; exit 1; } +# Prompting — works even under `curl … | bash`, where stdin is the script pipe. +# We prompt on the controlling terminal instead of relying on stdin. +have_tty() { + [ -t 1 ] || return 1 + [ -t 0 ] && return 0 + [ -r /dev/tty ] +} + +tty_read() { + local __var="$1" __val="" + if [ -t 0 ] || [ ! -r /dev/tty ]; then + read -r __val || true + else + read -r __val