From aba58cf1a0d01a7b423df0b233eae4a7b8445432 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Thu, 6 Aug 2026 14:22:49 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20deploy=5Fnvr.sh=20=E2=80=94=20stops=20s?= =?UTF-8?q?ervice=20before=20rebuild,=20update=20instructions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +++++++++----- setup.sh => deploy_nvr.sh | 20 ++++++++++++++++++-- 2 files changed, 27 insertions(+), 7 deletions(-) rename setup.sh => deploy_nvr.sh (92%) diff --git a/README.md b/README.md index 1f6ad58..ad4da1a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A simple, single-binary IP camera recorder. Think of it as a dashcam for your pr The open-source NVR landscape is rich with incredible projects — Frigate, Shinobi, ZoneMinder, Blue Iris alternatives — backed by passionate communities. They're powerful. They're feature-packed. But they've also become complex. Docker containers, AI pipelines, multi-service architectures, cloud integrations — for many users, it's too much. -**NextNVR is different.** It does one thing: continuously record your IP cameras to disk and let you review the footage. No AI, no cloud, no Docker — just a single Go binary you can run on a Raspberry Pi 5, an old thin client, or a VM. Deploy it in 30 seconds with a one-liner. +**NextNVR is different.** It does one thing: continuously record your IP cameras to disk and let you review the footage. No AI, no cloud, no Docker — just a single Go binary you can run on a Raspberry Pi 5, an old thin client, or a VM. Deploy in 30 seconds — download, run, done. This project was built with the help of AI — designed through conversation, refined through iteration, and shaped by the simple principle that surveillance software should be boring. It should just work. @@ -17,15 +17,19 @@ This project was built with the help of AI — designed through conversation, re ## Quick Install ```bash -curl -sSL https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/setup.sh | bash +curl -sSLO https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/deploy_nvr.sh +chmod +x deploy_nvr.sh +./deploy_nvr.sh ``` -The script will ask where to store recordings. Press Enter for the default (`~/nvr_data`) or type your own path (e.g. `/mnt/recordings`). +The script asks where to store recordings, then installs everything. Press Enter for the default (`~/nvr_data`) or type your own path. -**Want to pre-set the storage path without being asked?** +**To update an existing installation** — run the same script again. It stops the service, pulls the latest code, rebuilds, and restarts. + +**To pre-set the storage path:** ```bash -STORAGE_PATH=/mnt/recordings curl -sSL https://...setup.sh | bash +STORAGE_PATH=/mnt/recordings ./deploy_nvr.sh ``` --- diff --git a/setup.sh b/deploy_nvr.sh similarity index 92% rename from setup.sh rename to deploy_nvr.sh index b09e0e1..3d35ad8 100755 --- a/setup.sh +++ b/deploy_nvr.sh @@ -1,6 +1,7 @@ #!/bin/bash -# NextNVR — Portable One-Line Deployment Script -# Usage: curl -sSL https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/setup.sh | bash +# NextNVR — Deploy & Update Script +# Usage: curl -sSLO https://git.lohmar.co.uk/cclohmar/NextNVR/raw/branch/main/deploy_nvr.sh +# chmod +x deploy_nvr.sh && ./deploy_nvr.sh # # Supports: Debian, Ubuntu, Fedora, RHEL, Rocky, Alma, Arch, Alpine # Requires: curl, sudo, systemd (or falls back to nohup for non-systemd) @@ -33,6 +34,21 @@ echo " $(uname -m) / $(uname -s)" echo "============================================" echo "" +# ── 0. Stop existing service (clean update) ── +if systemctl is-active --quiet "${SERVICE_NAME}" 2>/dev/null; then + log "Stopping existing NextNVR service..." + sudo systemctl stop "${SERVICE_NAME}" + log "Service stopped." +elif pgrep -f "/opt/nextnvr/nextnvr" > /dev/null 2>&1; then + warn "NextNVR is running outside systemd. Stopping..." + sudo pkill -f "/opt/nextnvr/nextnvr" 2>/dev/null || true + sleep 2 +fi + +# Clean up any lingering processes. +sudo pkill -f "go2rtc" 2>/dev/null || true +sudo pkill -f "ffmpeg.*rec_" 2>/dev/null || true + # ── Check for sudo ── if ! command -v sudo &>/dev/null; then if [ "$(id -u)" -eq 0 ]; then