From e61aab2df5e0e58aaa0a4ed32a3185a044201078 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Thu, 6 Aug 2026 14:09:33 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20handle=20non-interactive=20piped=20insta?= =?UTF-8?q?ll=20=E2=80=94=20default=20$HOME/nvr=5Fdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index f462b15..826ec5a 100755 --- a/setup.sh +++ b/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%/}"