From aac1bc5c881b85f1d430bfb74d633e1c2717099e Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Fri, 28 Jun 2024 09:52:10 -0400 Subject: [PATCH] Move mount checks to appropriate sections --- ingest-mac.sh | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/ingest-mac.sh b/ingest-mac.sh index b36b886..247bd20 100755 --- a/ingest-mac.sh +++ b/ingest-mac.sh @@ -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!!