6b7c1c66b2fb70f5120e640e5a642dc883a91632

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

Message

Fix shellcheck error SC2128

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index 37694882b29968ea8f078b6903d0e8780f36da0e..fc771a38b992af16d6feb124b2cf690f7611161d 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -302,8 +302,8 @@ check_variables ()
 6 {
 7   [[ ${ROOT} = "" ]] && config_sanity_fail "ROOT must be configured"
 8   [[ ${DEST} = "" || ${DEST} = "s3+http://backup-foobar-bucket/backup-folder/" ]] && config_sanity_fail "DEST must be configured"
 9-  [[ ${INCLIST} = "/home/foobar_user_name/Documents/" ]] && config_sanity_fail "INCLIST must be configured"
10-  [[ ${EXCLIST} = "/home/foobar_user_name/Documents/foobar-to-exclude" ]] && config_sanity_fail "EXCLIST must be configured"
11+  [[ ${INCLIST[0]} = "/home/foobar_user_name/Documents/" ]] && config_sanity_fail "INCLIST must be configured"
12+  [[ ${EXCLIST[0]} = "/home/foobar_user_name/Documents/foobar-to-exclude" ]] && config_sanity_fail "EXCLIST must be configured"
13   [[ ( ${ENCRYPTION} = "yes" && (${GPG_ENC_KEY} = "foobar_gpg_key" || \
14        ${GPG_SIGN_KEY} = "foobar_gpg_key" || \
15        ${PASSPHRASE} = "foobar_gpg_passphrase")) ]] && \
16@@ -475,7 +475,7 @@ get_source_file_size()
17   done
18 
19   # if INCLIST is not set or empty, add ROOT to it to be able to calculate disk usage
20-  if [ -z "${INCLIST}" ]; then
21+  if [ ${#INCLIST[@]} -eq 0 ]; then
22     DUINCLIST=(${ROOT})
23   else
24     DUINCLIST=("${INCLIST[@]}")
25@@ -588,7 +588,7 @@ include_exclude()
26   fi
27 
28   # INCLIST and globbing filelist is empty so every file needs to be saved
29-  if [ "${INCLIST}" == '' ] && [ "${INCEXCFILE}" == '' ]; then
30+  if [ ${#INCLIST[@]} -eq 0 ] && [ "${INCEXCFILE}" == '' ]; then
31     EXCLUDEROOT=''
32   else
33     EXCLUDEROOT="--exclude=**"