From 467c37362c20298945e4c0de34a96b7b851b4d2f Mon Sep 17 00:00:00 2001 From: Tracey Clark Date: Sun, 7 Jun 2020 13:22:23 -0500 Subject: [PATCH] Updated mount declaration to get mount point via findmnt rather than hard coding --- local_backup.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/local_backup.sh b/local_backup.sh index 0fa4356..70b85bf 100755 --- a/local_backup.sh +++ b/local_backup.sh @@ -13,17 +13,10 @@ echo "" # echo "OS we're running on is $OS" source ~/git/shell-scripts/check_os.sh -if [[ "$OS" =~ .*Solus.* ]] - then - echo "Setting mount point for Solus" - mount_point='/run/media/tracey/LinuxBack' -elif [[ "$OS" = "Ubuntu" ]] - then - echo "Setting mount point for Ubuntu" - mount_point='/media/tracey/LinuxBack' -else - echo "Unknown OS!" -fi +# Get the mount point by uuid +UUID=ff0b3c83-853d-452f-abb6-48069e337446 +mount_point=`findmnt -rn -S UUID=$UUID -o TARGET` + echo "Mount point is $mount_point" # Check whether target volume is mounted, and mount it if not. @@ -39,7 +32,7 @@ else echo "${mount_point} is already mounted."; fi # Target volume **must** be mounted by this point. If not, die screaming. if ! mountpoint -q ${mount_point}/; then - echo "Mounting failed! Cannot run backup without backup volume!" + echo "Mounting failed! Cannot run backup without mounted backup volume!" exit 1 fi