aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsquashfu21
1 files changed, 8 insertions, 13 deletions
diff --git a/squashfu b/squashfu
index 7852038..1454681 100755
--- a/squashfu
+++ b/squashfu
@@ -307,33 +307,28 @@ action_rollback () {
action_report () {
info "SquashFu Usage Report"
- echo
# Enumerate bins, sort date order, print human readable create date and size
pushd "$BINS_DIR" &>/dev/null
- OIFS=$IFS;IFS=${IFS}$':'
# Collect all data into an array to 'preload' it. Index 0 is the entire
# folder. The following indicies correspond to the bin number of that index
- printf "%30s\r" ".: Loading :." >&2
- IFS=$'\n' read -r -d $'\0' -a data < <(du -csh . * 2>/dev/null | sort -n -k2)
- for d in "${data[@]}"; do
- local bin=${d#*[[:space:]]}
- local size=${d%[[:space:]]*}
+ printf "\n%30s\r" ".: Loading :." >&2
+
+ while read size bin; do
case ${bin} in
'total') total=$size; continue ;;
'.') DATA[0]=$size ;;
*) DATA[${bin}]=$size ;;
esac
- done
+ done < <(du -csh . * 2>/dev/null | sort -n -k2)
printf "%30s\r" "" >&2
printf "%10s\t%25s\t%7s\n" "Bin ID" "Date Created" "Size"
- grep -vE "^[\t ]*$" "$BINVENTORY" | sort -r -t: -k2 -n | while read bin stamp; do
- printf "%10d\t%25s\t%7s\n" "$bin" \
- "$(date --rfc-3339=seconds --date="@$stamp")" \
- "${DATA[$bin]}"
- done
+ OIFS=$IFS;IFS=${IFS}$':'
+ while read bin stamp; do
+ printf "%10d\t%25s\t%7s\n" "$bin" "$(date --rfc-3339=seconds --date="@$stamp")" "${DATA[$bin]}"
+ done < <(grep -v "^[[:space:]]*$" "$BINVENTORY" | sort -nr -t':' -k2)
IFS=$OIFS
printf "%10s\t%25s\t%7s\n" "" "Incremental Total" "${DATA[0]}"