[cmd_du] Added function to check total projected disk usage of selected IMAGEIDs

This commit is contained in:
ayakael 2018-04-06 19:02:10 -04:00
parent 72aac8134f
commit ad853a61bf
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
2 changed files with 27 additions and 1 deletions

21
src/cmd_du Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# doc cmd_du {
#
# DESCRIPTION
# cmd_du - Prints disk usage information like TOTAL USAGE of IMAGEID files on TARGET.
#
# USAGE
# cmd_du </path/to/git/dir> </path/to/target/dir>
#
# }
cmd_du() {
local GIT_DIR="${1}"
local TARGET="${2}"
local DB_FILE="${TARGET}/${_OPT_DB_FILE}"
local imageidList=($(awk 'BEGIN{FS="\t"}{if($1=="true"){print $2}}' ${DB_FILE} | awk '!seen[$0]++'))
local DU="$(print_imageid_du ${GIT_DIR} ${imageidList[@]})"
_msg ECHO "Current estimated disk usage: ${DU} bytes"
}

View file

@ -23,6 +23,11 @@ case "${1}" in
update)
shift
cmd_update ${@}
;;
;;
du)
shift
cmd_du "${@}"
;;
esac