fix: handle non-interactive piped install — default $HOME/nvr_data
This commit is contained in:
parent
1cbf03d384
commit
e61aab2df5
1 changed files with 13 additions and 2 deletions
15
setup.sh
15
setup.sh
|
|
@ -148,9 +148,20 @@ echo ""
|
|||
log "Step 1c/7: Where should recordings be stored?"
|
||||
info " This is where video clips and snapshots will be saved."
|
||||
info " Examples: /mnt/recordings, /home/user/nvr, /media/usb-drive"
|
||||
info " Or set STORAGE_PATH environment variable to skip the prompt."
|
||||
echo ""
|
||||
read -p " Storage path [${HOME}/nvr_data]: " STORAGE_PATH
|
||||
STORAGE_PATH="${STORAGE_PATH:-${HOME}/nvr_data}"
|
||||
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
|
||||
STORAGE_PATH="${STORAGE_PATH:-${HOME}/nvr_data}"
|
||||
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."
|
||||
fi
|
||||
# Strip trailing slash.
|
||||
STORAGE_PATH="${STORAGE_PATH%/}"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue