From 1440b3811d5aa47ec21820337fce85b42be0e211 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 13 Sep 2024 17:58:49 -0700 Subject: [PATCH] proxmox: scripts --- .../install-scrypted-proxmox.sh | 0 install/proxmox/setup-scrypted-nvr-volume.sh | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+) rename install/{local => proxmox}/install-scrypted-proxmox.sh (100%) create mode 100644 install/proxmox/setup-scrypted-nvr-volume.sh diff --git a/install/local/install-scrypted-proxmox.sh b/install/proxmox/install-scrypted-proxmox.sh similarity index 100% rename from install/local/install-scrypted-proxmox.sh rename to install/proxmox/install-scrypted-proxmox.sh diff --git a/install/proxmox/setup-scrypted-nvr-volume.sh b/install/proxmox/setup-scrypted-nvr-volume.sh new file mode 100644 index 0000000000..585d43d425 --- /dev/null +++ b/install/proxmox/setup-scrypted-nvr-volume.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +NVR_STORAGE=$1 + +# Check if NVR_STORAGE is set +if [ -z "$NVR_STORAGE" ]; then + echo "Error: NVR_STORAGE environment variable is not set." + exit 1 +fi + +# File to be modified +if [ -z "$VMID" ] +then + VMID="10443" +fi +FILE="/etc/pve/lxc/$VMID.conf" + +# valdiate file exists +if [ ! -f "$FILE" ]; then + echo "Error: $FILE not found." + echo "If the Scrypted container id is not 10443, please set the VMID environment variable prior to running this script." + exit 1 +fi + +# Remove all lines containing "mnt/nvr" +sed -i '/mnt\/nvr/d' "$FILE" + +# Append the new line with the substituted $NVR_STORAGE +echo "lxc.mount.entry: /mnt/pve/nvr-storage/mounts/$NVR_STORAGE mnt/nvr/large/$NVR_STORAGE none bind,optional,create=dir // [!code focus]" >> "$FILE" + +echo "$FILE modified successfully. Starting Scrypted..." +pct start $VMID