Skip to content

Commit

Permalink
proxmox: dir script
Browse files Browse the repository at this point in the history
  • Loading branch information
Koushik Dutta authored and Koushik Dutta committed Sep 14, 2024
1 parent c73ffb3 commit 9b30064
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions install/proxmox/setup-scrypted-nvr-volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

NVR_STORAGE=$1

# Check if NVR_STORAGE is set
if [ -z "$NVR_STORAGE" ]; then
echo "Error: Proxmox Directory Disk not provided."
echo "Error: Proxmox Directory Disk not provided. Usage:"
echo ""
echo "Usage:"
echo "$0 <proxmox-directory-disk>"
echo ""
echo " $0 <proxmox-directory-disk>"
exit 1
fi

# File to be modified
if [ -z "$VMID" ]
then
VMID="10443"
Expand All @@ -26,18 +23,25 @@ if [ ! -f "$FILE" ]; then
exit 1
fi

if [ ! -d "/mnt/pve/nvr-storage/mounts/$NVR_STORAGE" ]
STORAGE="/mnt/pve/$NVR_STORAGE"

if [ ! -d "$STORAGE" ]
then
echo "Error: /mnt/pve/nvr-storage/mounts/$NVR_STORAGE not found."
echo "Error: $STORAGE not found."
echo "The Proxmox Directory Storage must be created using the UI prior to running this script."
exit 1
fi

# Remove all lines containing "mnt/nvr"
# use subdirectory doesn't conflict with Proxmox storage of backups etc...
STORAGE="$STORAGE/mounts/scrypted-nvr"
mkdir -p $STORAGE
chmod 0777 $STORAGE

pct stop "$VMID"

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 "lxc.mount.entry: $STORAGE mnt/nvr/large/$NVR_STORAGE none bind,optional,create=dir" >> "$FILE"

echo "$FILE modified successfully. Starting Scrypted..."
pct start $VMID

0 comments on commit 9b30064

Please sign in to comment.