Rework on the pull request to refactor the new code
This commit is contained in:
parent
6f5b0dccc8
commit
2e6e383538
1 changed files with 18 additions and 21 deletions
|
|
@ -357,14 +357,14 @@ get_source_file_size()
|
||||||
|
|
||||||
case `uname` in
|
case `uname` in
|
||||||
FreeBSD|Darwin|DragonFly)
|
FreeBSD|Darwin|DragonFly)
|
||||||
DUEXCFLAG="-I -"
|
DUEXCFLAG="-I -"
|
||||||
;;
|
;;
|
||||||
OpenBSD)
|
OpenBSD)
|
||||||
echo "WARNING: OpenBSD du does not support exclusion, sizes may be off" >> ${LOGFILE}
|
echo "WARNING: OpenBSD du does not support exclusion, sizes may be off" >> ${LOGFILE}
|
||||||
DUEXCFLAG=""
|
DUEXCFLAG=""
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
DUEXCFLAG="--exclude-from=-"
|
DUEXCFLAG="--exclude-from=-"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
@ -372,23 +372,20 @@ get_source_file_size()
|
||||||
DUEXCLIST="${DUEXCLIST}${exclude}\n"
|
DUEXCLIST="${DUEXCLIST}${exclude}\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
# if $INCLIST non zero then itterate through it for du -hs readings, else just du -hs $ROOT
|
# if INCLIST is not set or empty, add ROOT to it to be able to calculate disk usage
|
||||||
# in both cases consider the excluded directories
|
|
||||||
if [ ! -z "$INCLIST" ]; then
|
if [ ! -z "$INCLIST" ]; then
|
||||||
for include in ${INCLIST[@]}
|
DUINCLIST=($ROOT)
|
||||||
do
|
|
||||||
echo -e "$DUEXCLIST" | \
|
|
||||||
du -hs ${DUEXCFLAG} ${include} | \
|
|
||||||
awk '{ FS="\t"; $0=$0; print $1"\t"$2 }' \
|
|
||||||
>> ${LOGFILE}
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
echo -e "$DUEXCLIST" | \
|
DUINCLIST=$INCLIST
|
||||||
du -hs ${DUEXCFLAG} $ROOT | \
|
|
||||||
awk '{ FS="\t"; $0=$0; print $1"\t"$2 }' \
|
|
||||||
>> ${LOGFILE}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for include in ${DUINCLIST[@]}; do
|
||||||
|
echo -e "$DUEXCLIST" | \
|
||||||
|
du -hs ${DUEXCFLAG} ${include} | \
|
||||||
|
awk '{ FS="\t"; $0=$0; print $1"\t"$2 }' \
|
||||||
|
>> ${LOGFILE}
|
||||||
|
done
|
||||||
|
|
||||||
echo >> ${LOGFILE}
|
echo >> ${LOGFILE}
|
||||||
|
|
||||||
# Restore IFS
|
# Restore IFS
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue