fix: handle non-interactive piped install — default $HOME/nvr_data

This commit is contained in:
Claus Lohmar 2026-08-06 14:09:33 +01:00
parent 1cbf03d384
commit e61aab2df5

View file

@ -148,9 +148,20 @@ echo ""
log "Step 1c/7: Where should recordings be stored?" log "Step 1c/7: Where should recordings be stored?"
info " This is where video clips and snapshots will be saved." info " This is where video clips and snapshots will be saved."
info " Examples: /mnt/recordings, /home/user/nvr, /media/usb-drive" info " Examples: /mnt/recordings, /home/user/nvr, /media/usb-drive"
info " Or set STORAGE_PATH environment variable to skip the prompt."
echo "" 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 read -p " Storage path [${HOME}/nvr_data]: " STORAGE_PATH
STORAGE_PATH="${STORAGE_PATH:-${HOME}/nvr_data}" 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. # Strip trailing slash.
STORAGE_PATH="${STORAGE_PATH%/}" STORAGE_PATH="${STORAGE_PATH%/}"