7a84fbdfa8819afebba29e251d664d8790ba05af

Author
Marc Gallet <mgallet@ffe.de>
Committer
Marc Gallet <mgallet@ffe.de>
Date

Message

Fix for issue #128

Diff

 1diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
 2index 6911eec7fc1f98a7b4f285baca02741e92bf6375..deb24b0cae8b6be96a47e3d3d4a88be30c330eee 100644
 3--- a/duplicity-backup.conf.example
 4+++ b/duplicity-backup.conf.example
 5@@ -208,6 +208,9 @@ INCLIST=( "/home/foobar_user_name/Documents/" )
 6 #            "/**Icon?" \
 7 #            "/**.AppleDouble" \
 8 #        )
 9+#
10+# If you don't want to exclude anything, use EXCLIST=()
11+#
12 # Simpler example with one location. Adapt it to your needs.
13 
14 EXCLIST=( "/home/foobar_user_name/Documents/foobar-to-exclude" )
15diff --git a/duplicity-backup.sh b/duplicity-backup.sh
16index 5e122b2718b7ae32de518d756ceee442339945b2..b3d78c3605fd059debaca7267f37ebeffe67e0e3 100755
17--- a/duplicity-backup.sh
18+++ b/duplicity-backup.sh
19@@ -553,7 +553,7 @@ include_exclude()
20   OLDIFS=$IFS
21   IFS=$(echo -en "\t\n")
22 
23-  # Exlcude device files?
24+  # Exclude device files?
25   if [ ! -z "${EXDEVICEFILES}" ] && [ "${EXDEVICEFILES}" -ne 0 ]; then
26     TMP=" --exclude-device-files"
27     EXCLUDE=${EXCLUDE}${TMP}
28@@ -561,14 +561,18 @@ include_exclude()
29 
30   for include in "${INCLIST[@]}"
31   do
32-    TMP=" --include='$include'"
33-    INCLUDE=${INCLUDE}${TMP}
34+    if [[ -n "$include" ]]; then
35+      TMP=" --include='$include'"
36+      INCLUDE=${INCLUDE}${TMP}
37+    fi
38   done
39 
40   for exclude in "${EXCLIST[@]}"
41   do
42-    TMP=" --exclude '$exclude'"
43-    EXCLUDE=${EXCLUDE}${TMP}
44+    if [[ -n "$exclude" ]]; then
45+      TMP=" --exclude '$exclude'"
46+      EXCLUDE=${EXCLUDE}${TMP}
47+    fi
48   done
49 
50   # Include/Exclude globbing filelist