fix: one-liner reads from /dev/tty for interactive prompt, README explains both methods

This commit is contained in:
Claus Lohmar 2026-08-06 14:18:16 +01:00
parent 6f0576d534
commit 7c7c920f5e
2 changed files with 11 additions and 7 deletions

View file

@ -20,7 +20,13 @@ This project was built with the help of AI — designed through conversation, re
curl -sSL https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/setup.sh | bash curl -sSL https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/setup.sh | bash
``` ```
That's it. The script installs everything and starts NextNVR automatically. The script will ask where to store recordings. Press Enter for the default (`~/nvr_data`) or type your own path (e.g. `/mnt/recordings`).
**Want to pre-set the storage path without being asked?**
```bash
STORAGE_PATH=/mnt/recordings curl -sSL https://...setup.sh | bash
```
--- ---

View file

@ -152,15 +152,13 @@ info " Or set STORAGE_PATH environment variable to skip the prompt."
echo "" echo ""
if [ -n "${STORAGE_PATH}" ]; then if [ -n "${STORAGE_PATH}" ]; then
log "Using STORAGE_PATH from environment: ${STORAGE_PATH}" log "Using STORAGE_PATH from environment: ${STORAGE_PATH}"
elif [ -t 0 ]; then elif [ -e /dev/tty ]; then
# Interactive terminal — ask the user. read -p " Storage path [${HOME}/nvr_data]: " STORAGE_PATH </dev/tty
read -p " Storage path [${HOME}/nvr_data]: " STORAGE_PATH
STORAGE_PATH="${STORAGE_PATH:-${HOME}/nvr_data}" STORAGE_PATH="${STORAGE_PATH:-${HOME}/nvr_data}"
echo "" # newline after prompt
else else
# Non-interactive (piped install) — use default.
STORAGE_PATH="${HOME}/nvr_data" STORAGE_PATH="${HOME}/nvr_data"
warn "Non-interactive install — using default storage: ${STORAGE_PATH}" warn "No terminal available — using default storage: ${STORAGE_PATH}"
info " To change: export STORAGE_PATH=/your/path before running this script."
fi fi
# Strip trailing slash. # Strip trailing slash.
STORAGE_PATH="${STORAGE_PATH%/}" STORAGE_PATH="${STORAGE_PATH%/}"