diff --git a/check_os.sh b/check_os.sh new file mode 100755 index 0000000..30c30d5 --- /dev/null +++ b/check_os.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Check what OS we're on +OS=`awk -F = '/^NAME/{print $2}' /etc/os-release` +echo "OS found in /etc/os-release is $OS" +export OS="$OS" \ No newline at end of file diff --git a/local_backup.sh b/local_backup.sh index bde6d74..3162b56 100755 --- a/local_backup.sh +++ b/local_backup.sh @@ -3,11 +3,29 @@ #Script to back up /home/tracey to external USB drive #http://www.bobulous.org.uk/misc/rsync-backup.html date=`date +%Y-%m-%d` -mount_point='/media/tracey/Backup' log_file='/home/tracey/backuplogs/usb-rsync-backup-'${date}'.txt' echo "#####" echo "" + +# Check what OS we're on +# OS=`awk -F = '/NAME/{print $2}' /etc/os-release` +# 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/Backup' +elif [[ "$OS" = "Ubuntu" ]] + then + echo "Setting mount point for Ubuntu" + mount_point='/media/tracey/Backup' +else + echo "Unknown OS!" +fi +echo "Mount point is $mount_point" + # Check whether target volume is mounted, and mount it if not. if ! mountpoint -q ${mount_point}/; then echo "Mounting the external USB drive."