From 6ccf6917e451f013bac07bdbba1d7d39f2e0b9c9 Mon Sep 17 00:00:00 2001 From: Philip Date: Mon, 19 Jan 2015 17:17:56 +0000 Subject: [PATCH] Don't skip source disk use report when INCLIST unconfigured --- duplicity-backup.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/duplicity-backup.sh b/duplicity-backup.sh index af88800..a545f34 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -366,19 +366,29 @@ get_source_file_size() *) DUEXCFLAG="--exclude-from=-" ;; -esac + esac for exclude in ${EXCLIST[@]}; do DUEXCLIST="${DUEXCLIST}${exclude}\n" done - for include in ${INCLIST[@]} - do - echo -e '"'$DUEXCLIST'"' | \ - du -hs ${DUEXCFLAG} ${include} | \ - awk '{ FS="\t"; $0=$0; print $1"\t"$2 }' \ - >> ${LOGFILE} - done + # if $INCLIST non zero then itterate through it for df readings, else just df $ROOT + # in both cases consider the excluded directories + if [ ! -z "$INCLIST" ]; then + for include in ${INCLIST[@]} + do + echo -e '"'$DUEXCLIST'"' | \ + du -hs ${DUEXCFLAG} ${include} | \ + awk '{ FS="\t"; $0=$0; print $1"\t"$2 }' \ + >> ${LOGFILE} + done + else + echo -e '"'$DUEXCLIST'"' | \ + du -hs ${DUEXCFLAG} $ROOT | \ + awk '{ FS="\t"; $0=$0; print $1"\t"$2 }' \ + >> ${LOGFILE} + fi + echo >> ${LOGFILE} # Restore IFS