From: Christopher Clark Date: Thu, 3 Dec 2009 19:02:03 +0000 (+0000) Subject: XC-665: implement percentage complete calc for verifying repo X-Git-Url: http://xenbits.xen.org/gitweb?a=commitdiff_plain;h=8edda4afc109b977d3138d269564c6eee1b1e136;p=xenclient%2Fbuild.git XC-665: implement percentage complete calc for verifying repo --- diff --git a/target/generic/target_xenclient_installer_skeleton/install/stages/functions b/target/generic/target_xenclient_installer_skeleton/install/stages/functions index 0862d66..ea1fd83 100644 --- a/target/generic/target_xenclient_installer_skeleton/install/stages/functions +++ b/target/generic/target_xenclient_installer_skeleton/install/stages/functions @@ -329,6 +329,15 @@ validate_repo() PKG_LIST="$(package_list ${PKGDATA_FILE})" PERCENT=10 + # Count the number of files to determine the percentage complete + # per file. + FCOUNT=0 + for FILENAME in ${PKG_LIST} ; do + FCOUNT="$(( FCOUNT + 1 ))" + done + PERCENT_PER_FILE=90 + [ "${FCOUNT}" = 0 ] || PERCENT_PER_FILE="$(( 90 / FCOUNT ))" + # Validate the integrity of the downloaded packages, size and md5sum: for FILENAME in ${PKG_LIST} ; do MANIFEST_MD5SUM="$(sed -ne 's/^\(\S\+\s\+\)\{2\}\(\S\+\)\s\+\(\S\+\s\+\)\{2\}\('${FILENAME}'\)\s.*$/\2/p' <${PKGDATA_FILE})" @@ -337,7 +346,7 @@ validate_repo() mixedgauge "Verifying: ${FILENAME}" "${PERCENT}" FILE_MD5SUM="$(md5sum ${FILE} | cut -f1 -d' ')" - PERCENT="$(( PERCENT + 50 ))" # FIXME: proper calculation + PERCENT="$(( PERCENT + PERCENT_PER_FILE ))" FILE_SIZE="$(ls -l ${FILE} | sed -ne 's/^\(\S\+\s\+\)\{4\}\(\S\+\)\s\+.*$/\2/p')"