Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from islander/gdrive
Browse files Browse the repository at this point in the history
Add Google Drive support using rclone cli tool
  • Loading branch information
Ardakilic authored Oct 20, 2019
2 parents 9897480 + 053d05d commit 6595bcf
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions backmeup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ case $key in
SEVENZIP_COMPRESSION_PASSWORD="$2"
shift # past argument
;;
-gdrv|--gdrive-remote)
RCLONE_REMOTE="$2"
shift # past argument
;;
-s3bn|--s3-bucket-name)
S3_BUCKET_NAME="$2"
shift # past argument
Expand Down Expand Up @@ -179,6 +183,15 @@ then
fi
fi

if [[ "$METHOD" == "gdrive" ]];
then
if ! [[ -x "$(command -v rclone)" ]];
then
INSTALLABLE="nope"
ERRORMSGS+=('| You must install rclone cli to run this script to upload backups to Google Drive')
fi
fi


# Let's check whether the script is installable
if [[ "$INSTALLABLE" == "yes" ]];
Expand Down Expand Up @@ -293,6 +306,24 @@ then
echo '|'
fi

# If uploading method is set to Google Drive
if [[ "$METHOD" == "gdrive" ]];
then
if [[ ! -f "$HOME/.config/rclone/rclone.conf" ]];
then
echo '| You must configure the rclone first!'
echo '| Please run rclone config as the user which will run this script and follow the instructions.'
echo '| After that, re-run this script again'
fi
# https://rclone.org/drive/
echo '| Creating the directory and uploading to Google Drive...'
rclone mkdir "$RCLONE_REMOTE$BACKUPFOLDER"
rclone copy "$BASEFOLDER/$FILENAME" "$RCLONE_REMOTE$BACKUPFOLDER/$FILENAME"
echo '|'
echo '| Done!'
echo '|'
fi

echo '| Cleaning up...'
# Now let's cleanup
rm -r $FILENAME
Expand Down

0 comments on commit 6595bcf

Please sign in to comment.