4fbb5ed1909389bffad50c5664420e20977b1b89
- Author
- zertrin <zertrin@gmail.com>
- Committer
- zertrin <zertrin@gmail.com>
- Date
Message
Merge remote-tracking branch 'origin/fix-issue-128-incexc' into dev
Fix and improve handling of INCLIST and EXCLIST
Diff
1diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
2index cd74d805c9564cf9fa69b5796619ff961f11fb5b..ccb407edb310945ed2f3afe0b38bd9224d75be7a 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 0dba3513923e1381d920f79219549a584a590caa..a6eaaec949473e0699e38728743f956ab9a08b6f 100755
17--- a/duplicity-backup.sh
18+++ b/duplicity-backup.sh
19@@ -563,7 +563,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@@ -571,14 +571,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