Fix issue #33 : Allow to specify the s3cmd configuration file

This commit is contained in:
Zertrin 2013-01-14 01:04:56 +01:00
parent 1a77ee0d58
commit 6df09021a6
2 changed files with 18 additions and 2 deletions

View file

@ -43,6 +43,14 @@
AWS_ACCESS_KEY_ID="foobar_aws_key_id"
AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
# S3CMD INFORMATION
# Most people don't need that, but in some cases
# you may want to specify a custom configuration file
# to pass to s3cmd. If so, set the S3CMD_CONF_FILE variable
# to the full path of this custom config file.
# Per default s3cmd uses ${HOME}/.s3cfg
# S3CMD_CONF_FILE='/path/to/your/s3cmd/conf/file'
# ENCRYPTION INFORMATION
# Do you want your backup to be encrypted? yes/no
# If yes, please make sure you specify either PASSPHRASE or GPG_ENC_KEY/GPG_SIGN_KEY

View file

@ -195,10 +195,18 @@ if [ "`echo ${DEST} | cut -c 1,2`" = "s3" ]; then
S3CMD="$(which s3cmd)"
if [ ! -x "$S3CMD" ]; then
echo $NO_S3CMD; S3CMD_AVAIL=false
elif [ ! -f "${HOME}/.s3cfg" ]; then
elif [ -z "$S3CMD_CONF_FILE" -a ! -f "${HOME}/.s3cfg" ]; then
echo $NO_S3CMD_CFG; S3CMD_AVAIL=false
elif [ ! -z "$S3CMD_CONF_FILE" -a ! -f "$S3CMD_CONF_FILE" ]; then
echo "${S3CMD_CONF_FILE} not found, check S3CMD_CONF_FILE variable in duplicity-backup's configuration!";
echo $NO_S3CMD_CFG;
S3CMD_AVAIL=false
else
S3CMD_AVAIL=true
if [ ! -z "$S3CMD_CONF_FILE" -a -f "$S3CMD_CONF_FILE" ]; then
S3CMD="${S3CMD} -c ${S3CMD_CONF_FILE}"
fi
fi
else
DEST_IS_S3=false
@ -321,7 +329,7 @@ get_remote_file_size()
"s3")
if $S3CMD_AVAIL ; then
TMPDEST=$(echo ${DEST} | cut -c 11-)
SIZE=`s3cmd du -H s3://${TMPDEST} | awk '{print $1}'`
SIZE=`${S3CMD} du -H s3://${TMPDEST} | awk '{print $1}'`
else
SIZE="s3cmd not installed."
fi