Move mount checks to appropriate sections

This commit is contained in:
Skylar Grant 2024-06-28 09:52:10 -04:00
parent b693f153ea
commit aac1bc5c88

View File

@ -133,6 +133,27 @@ create_folders_mac() {
fi
}
# Check if the SD card is mounted
check_sd() {
if mount | grep -q "${SD_MOUNT_POINT[$INGEST_MODE]}"; then
touch /tmp/mounted
else
echo "ERR: SD Card Not mounted!"
exit 1
fi
}
# Check if the NAS is mounted
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)?$')
else
echo "ERR: NAS Not mounted!"
exit 1
fi
}
# Cleanup images on camera SD.
# TODO: Update this for the new combined script
clean_sd() {
@ -223,6 +244,7 @@ ingest_mac() {
# Mac->NAS Sync
ingest_nas() {
check_nas
local dry_run=""
# Detect if dry run
if [[ $1 -eq 1 ]]; then
@ -245,22 +267,7 @@ ingest_nas() {
# Check for Connections
######################################################################################
# Check if the SD card is mounted
if mount | grep -q "${SD_MOUNT_POINT[$INGEST_MODE]}"; then
touch /tmp/mounted
else
echo "ERR: SD Card Not mounted!"
exit 1
fi
# Check if the NAS is mounted
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)?$')
else
echo "ERR: NAS Not mounted!"
exit 1
fi
check_sd
######################################################################################
# Mode Prompt
@ -322,8 +329,7 @@ while true; do
4)
# !! Delete ALL media on SD card!!
clear
# clean_sd
echo "Untested and not working yet!"
clean_sd
;;
5)
# !! Delete ALL ingested media on Mac!!