Fix how NAS gets mounted to be more generic

This commit is contained in:
Skylar Grant 2024-10-08 21:31:20 -04:00
parent 626aab90f4
commit c111c1a23e

View File

@ -42,8 +42,9 @@ SD_MOUNT_POINT[1]="/Volumes/Untitled" # Drone
declare -a SD_SRC_PATH
SD_SRC_PATH[0]="/DCIM/100MSDCF" # Camera
SD_SRC_PATH[1]="/DCIM/100MEDIA" # Drone
# NAS Network Address
NAS_ADDRESS="//GUEST:@192.168.0.2/media"
# NAS Mount address as found with `mount`
NAS_ADDRESS="//voidf1sh@voidNAS"
declare NAS_MOUNT_POINT # Will be set later
# Folder where ingests are stored on the Mac
declare -a MAC_INGEST_FOLDER
@ -147,10 +148,10 @@ check_sd() {
check_nas() {
if mount | grep -q "$NAS_ADDRESS"; then
# Get the NAS mount point since it can vary
NAS_MOUNT_POINT=$(mount | grep "$NAS_ADDRESS" | awk '{print $3}' | grep -E '^/Volumes/media(-1)?$')
NAS_MOUNT_POINT=$(mount | grep "$NAS_ADDRESS" | awk '{print $3}' | grep -E '^/[^/]+')
echo "NAS Mounted at $NAS_MOUNT_POINT."
else
echo "ERR: NAS Not mounted!"
exit 1
fi
}
@ -252,6 +253,7 @@ ingest_nas() {
fi
echo "Beginning copy..."
echo "Syncing ingested images with NAS..."
echo "Debug: NAS_MOUNT_POINT inside function: $NAS_MOUNT_POINT"
echo "Source: ${MAC_INGEST_FOLDER[$INGEST_MODE]}/"
echo "Destination: $NAS_MOUNT_POINT${NAS_INGEST_FOLDER[$INGEST_MODE]}/"
echo "Press any key to continue..."
@ -268,6 +270,7 @@ ingest_nas() {
######################################################################################
check_sd
check_nas
######################################################################################
# Mode Prompt
@ -291,7 +294,8 @@ while true; do
echo ""
echo "Ingest Source Path: ${SD_MOUNT_POINT[$INGEST_MODE]}${SD_SRC_PATH[$INGEST_MODE]}"
echo "Mac Ingest Path: $MAC_INGEST_PATH"
echo "NAS Ingest Path: $NAS_MOUNT_POINT$NAS_INGEST_PATH"
echo "NAS Mount Path: $NAS_MOUNT_POINT"
echo "NAS Ingest Path: $NAS_INGEST_PATH"
echo ""
echo "Please enter an option from below:"
echo ""