Merge pull request #40 from brki/allow-s3-scheme-when-getting-remote-size

Let s3cmd have the correct bucket name when using s3 scheme
This commit is contained in:
zertrin 2013-03-31 13:09:01 -07:00
commit 2f3af1ab4d
2 changed files with 11 additions and 2 deletions

View file

@ -90,8 +90,12 @@ ROOT="/home"
# for you). If you don't want to use Amazon S3, you can backup
# to a file or any of duplicity's supported outputs.
#
# NOTE: You do need to keep the "s3+http://<your location>/" format
# even though duplicity supports "s3://<your location>/".
# The s3+http scheme uses the default aws s3 hostname.
# Use s3://host/bucket/[backup-folder/] if you want to specify the host name.
# If using the s3://... scheme and you have s3cmd installed, be sure to change
# 's3.amazonaws.com' to the appropriate host in your .s3cfg file so that the
# remote file size check will work.
#DEST="s3://host/backup-bucket/backup-folder/"
DEST="s3+http://backup-bucket/backup-folder/"
# Other possible locations
#DEST="ftp://user[:password]@other.host[:port]/some_dir"

View file

@ -338,6 +338,11 @@ get_remote_file_size()
"s3")
if $S3CMD_AVAIL ; then
TMPDEST=$(echo ${DEST} | cut -c 11-)
dest_scheme=$(echo ${DEST} | cut -f -1 -d :)
if [ "$dest_scheme" = "s3" ]; then
# Strip off the host name, too.
TMPDEST=`echo $TMPDEST | cut -f 2- -d /`
fi
SIZE=`${S3CMD} du -H s3://${TMPDEST} | awk '{print $1}'`
else
SIZE="s3cmd not installed."