fix: one-liner reads from /dev/tty for interactive prompt, README explains both methods
This commit is contained in:
parent
6f0576d534
commit
7c7c920f5e
2 changed files with 11 additions and 7 deletions
|
|
@ -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
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
10
setup.sh
10
setup.sh
|
|
@ -152,15 +152,13 @@ info " Or set STORAGE_PATH environment variable to skip the prompt."
|
|||
echo ""
|
||||
if [ -n "${STORAGE_PATH}" ]; then
|
||||
log "Using STORAGE_PATH from environment: ${STORAGE_PATH}"
|
||||
elif [ -t 0 ]; then
|
||||
# Interactive terminal — ask the user.
|
||||
read -p " Storage path [${HOME}/nvr_data]: " STORAGE_PATH
|
||||
elif [ -e /dev/tty ]; then
|
||||
read -p " Storage path [${HOME}/nvr_data]: " STORAGE_PATH </dev/tty
|
||||
STORAGE_PATH="${STORAGE_PATH:-${HOME}/nvr_data}"
|
||||
echo "" # newline after prompt
|
||||
else
|
||||
# Non-interactive (piped install) — use default.
|
||||
STORAGE_PATH="${HOME}/nvr_data"
|
||||
warn "Non-interactive install — using default storage: ${STORAGE_PATH}"
|
||||
info " To change: export STORAGE_PATH=/your/path before running this script."
|
||||
warn "No terminal available — using default storage: ${STORAGE_PATH}"
|
||||
fi
|
||||
# Strip trailing slash.
|
||||
STORAGE_PATH="${STORAGE_PATH%/}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue