Google Cloud Storage support

This commit is contained in:
Giovanni Pini 2015-05-10 12:49:41 +02:00 committed by Giovanni Pini
parent 6256f0a701
commit 8abfd40c30
2 changed files with 19 additions and 0 deletions

View file

@ -46,6 +46,11 @@
AWS_ACCESS_KEY_ID="foobar_aws_key_id"
AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
# GOOGLE CLOUD STORAGE INFORMATION
# Comment out these lines if you're not using Google Cloud storage
GS_ACCESS_KEY_ID="foobar_gcs_key_id"
GS_SECRET_ACCESS_KEY="foobar_gcs_secret_id"
# S3CMD INFORMATION
# Most people don't need this, but in some cases
# you may want to specify a custom configuration file
@ -117,6 +122,7 @@ DEST="s3+http://foobar-backup-bucket/backup-folder/"
# Be sure to check duplicity's man page to know how to use them
# (http://duplicity.nongnu.org/duplicity.1.html)
#
#DEST="gs://foobar-backup-bucket/backup-folder/"
#DEST="ftp://user[:password]@other.host[:port]/some_dir"
#DEST="rsync://user@host.com[:port]//absolute_path"
#DEST="scp://user[:password]@other.host[:port]/[/]some_dir"

View file

@ -171,6 +171,8 @@ STATIC_OPTIONS="$DRY_RUN$STATIC_OPTIONS"
SIGN_PASSPHRASE=$PASSPHRASE
export AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY
export GS_ACCESS_KEY_ID
export GS_SECRET_ACCESS_KEY
export PASSPHRASE
export SIGN_PASSPHRASE
if [[ -n "$FTP_PASSWORD" ]]; then
@ -224,6 +226,10 @@ if [ ! -x "$DUPLICITY" ]; then
exit 1
fi
if [ "`echo ${DEST} | cut -c 1,2`" = "gs" ]; then
DEST_IS_GS=true
fi
if [ "`echo ${DEST} | cut -c 1,2`" = "s3" ]; then
DEST_IS_S3=true
S3CMD="$(which s3cmd)"
@ -270,6 +276,8 @@ check_variables ()
[[ ${LOGDIR} = "/home/foobar_user_name/logs/test2/" ]] && config_sanity_fail "LOGDIR must be configured"
[[ ( ${DEST_IS_S3} = true && (${AWS_ACCESS_KEY_ID} = "foobar_aws_key_id" || ${AWS_SECRET_ACCESS_KEY} = "foobar_aws_access_key" )) ]] && \
config_sanity_fail "An s3 DEST has been specified, but AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY have not been configured"
[[ ( ${DEST_IS_GS} = true && (${GS_ACCESS_KEY_ID} = "foobar_gcs_key_id" || ${GS_SECRET_ACCESS_KEY} = "foobar_gcs_secret_id" )) ]] && \
config_sanity_fail "A Google Cloud Storage DEST has been specified, but GS_ACCESS_KEY_ID or GS_SECRET_ACCESS_KEY have not been configured"
[[ ! -z "$INCEXCFILE" && ! -f $INCEXCFILE ]] && config_sanity_fail "The specified INCEXCFILE $INCEXCFILE does not exists"
}
@ -406,6 +414,11 @@ get_remote_file_size()
TMPDEST=`echo ${DEST} | cut -c 6-`
SIZE=`du -hs ${TMPDEST} | awk '{print $1}'`
;;
"gs")
FRIENDLY_TYPE_NAME="Google Cloud Storage"
#TMPDEST=`echo ${DEST} | cut -c 4-`
#SIZE=`du -hs ${TMPDEST} | awk '{print $1}'`
;;
"s3")
FRIENDLY_TYPE_NAME="S3"
if $S3CMD_AVAIL ; then