From d7476f0fe8ef296ce26642adabdbd28fb50c83ba Mon Sep 17 00:00:00 2001 From: Andrii Arsenin Date: Fri, 2 Oct 2026 15:52:57 +0300 Subject: [PATCH] fix(install): read prompts from the terminal and start liqa - read answers from /dev/tty: under `curl ... | bash` stdin is the script itself, so `read` consumed the script's own lines; fall back to defaults when there is no terminal - check that docker, the compose plugin and the daemon work and that compose accepts the generated compose.yaml - start liqa with `docker compose up -d` in the install directory, printing the manual start command if a check or the start fails --- scripts/install.sh | 57 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 1d7fb5c..be8f9a7 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -6,14 +6,20 @@ set -euo pipefail REGISTRY_IMAGE="git.hq.ars9.space/ars9/liqa" -read -rp "Install directory [./liqa]: " install_dir -install_dir="${install_dir:-./liqa}" +# Prompt on the terminal, not stdin: under `curl ... | bash` stdin is the +# script itself, so a plain `read` would consume the script's own lines. +# Without a terminal, the default is used. +ask() { + local prompt="$1" default="$2" answer="" + if { : /dev/null; then + read -rp "$prompt [$default]: " answer &2 + echo " cd $install_dir && docker compose up -d" >&2 + exit 1 +} + +if ! command -v docker >/dev/null 2>&1; then + echo "Error: docker is not installed. Install Docker Engine with the Compose plugin:" >&2 + echo " https://docs.docker.com/engine/install/" >&2 + start_hint +elif ! docker compose version >/dev/null 2>&1; then + echo "Error: the Docker Compose plugin (docker compose) is not available. Install it:" >&2 + echo " https://docs.docker.com/compose/install/linux/" >&2 + start_hint +elif ! docker compose -f "$compose_file" config --quiet >/dev/null 2>&1; then + echo "Error: docker compose rejected $compose_file:" >&2 + docker compose -f "$compose_file" config --quiet >&2 || true + start_hint +elif ! docker info >/dev/null 2>&1; then + echo "Error: can't reach the Docker daemon. Make sure it is running and that" >&2 + echo "your user may use it (e.g. is in the docker group), or use sudo." >&2 + start_hint +fi + +cd "$install_dir" +if ! docker compose up -d; then + echo >&2 + echo "Error: docker compose up failed." >&2 + start_hint +fi + +echo +echo "liqa is running at http://localhost:$port" +echo "Manage it from $install_dir with docker compose (ps, logs, down, pull)."