feat: deploy prompts for storage path on first install, preserves on update

This commit is contained in:
Claus Lohmar 2026-08-06 14:30:19 +01:00
parent 49b1b8a5ff
commit e790855f69

View file

@ -216,11 +216,25 @@ log "Binary built: nextnvr v${VERSION} ($(du -h nextnvr | cut -f1))"
# ── 5. Configuration & directories ── # ── 5. Configuration & directories ──
log "Step 5/6: Configuration..." log "Step 5/6: Configuration..."
# Repo includes a default config.yaml. Only warn if it's missing. # Repo includes a default config.yaml. Check if storage path needs setting.
if [ ! -f "${DEPLOY_DIR}/config.yaml" ]; then CURRENT_PATH=$(grep recordings_path "${DEPLOY_DIR}/config.yaml" 2>/dev/null | awk -F'"' '{print $2}')
err "config.yaml not found in repository — deployment may fail." if [ -z "${CURRENT_PATH}" ] || [ "${CURRENT_PATH}" = "/home/master/nvr_data" ]; then
echo ""
info "Storage path not set. Where should recordings be stored?"
if [ -e /dev/tty ]; then
read -p " Path [${HOME}/nvr_data]: " STORAGE_PATH </dev/tty
fi
STORAGE_PATH="${STORAGE_PATH:-${HOME}/nvr_data}"
STORAGE_PATH="${STORAGE_PATH%/}"
echo ""
sudo mkdir -p "${STORAGE_PATH}"
sudo chown "$(whoami):$(id -gn)" "${STORAGE_PATH}"
sed -i "s|recordings_path:.*|recordings_path: \"${STORAGE_PATH}\"|" "${DEPLOY_DIR}/config.yaml"
log "Storage: ${STORAGE_PATH}"
else
log "Storage: ${CURRENT_PATH}"
sudo mkdir -p "${CURRENT_PATH}" 2>/dev/null || true
fi fi
log "Using config: ${DEPLOY_DIR}/config.yaml"
# ── 6. Install service ── # ── 6. Install service ──
log "Step 6/6: Service installation..." log "Step 6/6: Service installation..."