-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Koushik Dutta
authored and
Koushik Dutta
committed
Sep 14, 2024
1 parent
cf4f4b7
commit 1440b38
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |