4be3671511bda9123272c512258e8eb60065e81e

Author
zertrin <zertrin@gmail.com>
Committer
zertrin <zertrin@gmail.com>
Date

Message

Fix bug #93 : make message about unsupported destination disk usage more explicit

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index 27c36e7dbde139050d6df5adc2f8ffd0c3629c23..c8927d13d74d19f26f0daa914694f9eeb2e24f1d 100644
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -426,6 +426,8 @@ get_remote_file_size()
 6   dest_type=`echo ${DEST} | cut -c 1,2`
 7   case $dest_type in
 8     "ss")
 9+      FRIENDLY_TYPE_NAME="SSH"
10+
11       TMPDEST="${DEST#*://*/}"
12       TMPDEST="${DEST%/${TMPDEST}}"
13       ssh_opt=`echo $STATIC_OPTIONS |awk -vo="--ssh-options=" '{s=index($0,o); if (s) {s=substr($0,s+length(o)); m=substr(s,0,1); for (i=2; i < length(s); i++) { if (substr(s,i,1) == m && substr(s,i-1,1) != "\\") break; } print substr(s,2,i-2)}}'`
14@@ -446,7 +448,7 @@ get_remote_file_size()
15       fi
16     ;;
17     "s3")
18-      FRIENDLY_TYPE_NAME="S3"
19+      FRIENDLY_TYPE_NAME="Amazon S3"
20       if $S3CMD_AVAIL ; then
21           TMPDEST=$(echo ${DEST} | cut -c 11-)
22           dest_scheme=$(echo ${DEST} | cut -f -1 -d :)
23@@ -464,13 +466,17 @@ get_remote_file_size()
24       fi
25     ;;
26     *)
27-      # cover all so just grab first 4 chars from DEST
28-      FRIENDLY_TYPE_NAME=`echo ${DEST} | cut -c 1,4`
29-      SIZE="unsupported on"
30+      # not yet available for the other backends
31+      FRIENDLY_TYPE_NAME=""
32     ;;
33   esac
34 
35-  echo -e ""$SIZE"\t"$FRIENDLY_TYPE_NAME" type backend" >> ${LOGFILE}
36+  if $FRIENDLY_TYPE_NAME ; then
37+      echo -e ""$SIZE"\t"$FRIENDLY_TYPE_NAME" type backend" >> ${LOGFILE}
38+  else
39+      echo "Destination disk use information is currently only available for the following storage backends:" >> ${LOGFILE}
40+      echo "File, SSH, Amazon S3 and Google Cloud" >> ${LOGFILE}
41+  fi
42   echo >> ${LOGFILE}
43 }
44