Updated mount declaration to get mount point via findmnt rather than hard coding

This commit is contained in:
Tracey Clark 2020-06-07 13:22:23 -05:00
commit 467c37362c

View file

@ -13,17 +13,10 @@ echo ""
# echo "OS we're running on is $OS" # echo "OS we're running on is $OS"
source ~/git/shell-scripts/check_os.sh source ~/git/shell-scripts/check_os.sh
if [[ "$OS" =~ .*Solus.* ]] # Get the mount point by uuid
then UUID=ff0b3c83-853d-452f-abb6-48069e337446
echo "Setting mount point for Solus" mount_point=`findmnt -rn -S UUID=$UUID -o TARGET`
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
echo "Mount point is $mount_point" echo "Mount point is $mount_point"
# Check whether target volume is mounted, and mount it if not. # Check whether target volume is mounted, and mount it if not.
@ -39,7 +32,7 @@ else echo "${mount_point} is already mounted.";
fi fi
# Target volume **must** be mounted by this point. If not, die screaming. # Target volume **must** be mounted by this point. If not, die screaming.
if ! mountpoint -q ${mount_point}/; then 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 exit 1
fi fi