3fcfb220c23376386148530a1529ed6429f6f02e

Author
Philip <philip@yewtreeapps.com>
Committer
Philip <philip@yewtreeapps.com>
Date

Message

add s3cmd config not found to dest disk use report

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index 3b69115414bbfd95d539cd7fbb7c3a58796d3606..96b29b828c6d67fb47d6f4ea16a8583be8d65623 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -230,15 +230,18 @@ if  [ "`echo ${DEST} | cut -c 1,2`" = "s3" ]; then
 6   if [ ! -x "$S3CMD" ]; then
 7     echo $NO_S3CMD; S3CMD_AVAIL=false
 8   elif [ -z "$S3CMD_CONF_FILE" -a ! -f "${HOME}/.s3cfg" ]; then
 9+    S3CMD_CONF_FOUND=false
10     echo $NO_S3CMD_CFG; S3CMD_AVAIL=false
11   elif [ ! -z "$S3CMD_CONF_FILE" -a ! -f "$S3CMD_CONF_FILE" ]; then
12+    S3CMD_CONF_FOUND=false
13     echo "${S3CMD_CONF_FILE} not found, check S3CMD_CONF_FILE variable in duplicity-backup's configuration!";
14     echo $NO_S3CMD_CFG;
15     S3CMD_AVAIL=false
16-  else
17+  else    
18     S3CMD_AVAIL=true
19-
20+    S3CMD_CONF_FOUND=true
21     if [ ! -z "$S3CMD_CONF_FILE" -a -f "$S3CMD_CONF_FILE" ]; then
22+      # if conf file specified and it exists then add it to the command line for s3cmd
23       S3CMD="${S3CMD} -c ${S3CMD_CONF_FILE}"
24     fi
25   fi
26@@ -412,7 +415,11 @@ get_remote_file_size()
27           fi
28           SIZE=`${S3CMD} du -H s3://${TMPDEST} | awk '{print $1}'`
29       else
30-          SIZE="s3cmd not installed."
31+          if ! $S3CMD_CONF_FOUND ; then
32+              SIZE="s3cmd config not found"
33+          else
34+              SIZE="s3cmd not installed"
35+          fi
36       fi
37     ;;
38     *)