7bb45ff939c6bca3776950731a61d07f284f0d97

Author
Brian King <free.as.in.speech@gmail.com>
Committer
Brian King <free.as.in.speech@gmail.com>
Date

Message

Let s3cmd have the correct bucket name when using s3 scheme

Diff

 1diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
 2index 0d5fb37c09ce4302310d3c91b32f4d2545c99886..cb09289031d1902ba0a2657950828a68df49fc7d 100644
 3--- a/duplicity-backup.conf.example
 4+++ b/duplicity-backup.conf.example
 5@@ -90,8 +90,12 @@ ROOT="/home"
 6 # for you).  If you don't want to use Amazon S3, you can backup
 7 # to a file or any of duplicity's supported outputs.
 8 #
 9-# NOTE: You do need to keep the "s3+http://<your location>/" format
10-# even though duplicity supports "s3://<your location>/".
11+# The s3+http scheme uses the default aws s3 hostname.
12+# Use s3://host/bucket/[backup-folder/] if you want to specify the host name.
13+# If using the s3://... scheme and you have s3cmd installed, be sure to change
14+# 's3.amazonaws.com' to the appropriate host in your .s3cfg file so that the
15+# remote file size check will work.
16+#DEST="s3://host/backup-bucket/backup-folder/"
17 DEST="s3+http://backup-bucket/backup-folder/"
18 # Other possible locations
19 #DEST="ftp://user[:password]@other.host[:port]/some_dir"
20diff --git a/duplicity-backup.sh b/duplicity-backup.sh
21index 90d09a0d04e9184e19bcfafb424bf6a0a2794469..225523b92d814176243ea47dd8100161eabfdb0b 100755
22--- a/duplicity-backup.sh
23+++ b/duplicity-backup.sh
24@@ -331,6 +331,11 @@ get_remote_file_size()
25     "s3")
26       if $S3CMD_AVAIL ; then
27           TMPDEST=$(echo ${DEST} | cut -c 11-)
28+          dest_scheme=$(echo ${DEST} | cut -f -1 -d :)
29+          if [ "$dest_scheme" = "s3" ]; then
30+              # Strip off the host name, too.
31+              TMPDEST=`echo $TMPDEST | cut -f 2- -d /`
32+          fi
33           SIZE=`${S3CMD} du -H s3://${TMPDEST} | awk '{print $1}'`
34       else
35           SIZE="s3cmd not installed."