[PC-BSD Commits] r15470 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Fri Feb 17 10:13:10 PST 2012


Author: kris
Date: 2012-02-17 18:13:09 +0000 (Fri, 17 Feb 2012)
New Revision: 15470

Modified:
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Add SPEED: calculations to pbi_add -r output for GUIS



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2012-02-17 17:57:32 UTC (rev 15469)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2012-02-17 18:13:09 UTC (rev 15470)
@@ -5256,6 +5256,7 @@
 		_fSize=`cat ${PBI_TMPDIR}/.fetch-size.$$ 2>/dev/null`
 		_fSize="`expr ${_fSize} / 1024 2>/dev/null`"
 		rm "${PBI_TMPDIR}/.fetch-size.$$" 2>/dev/null
+		_time=0
 
 		( fetch -o "${_lf}" "${_rf}" >/dev/null 2>/dev/null ; echo "$?" > ${_eFile} ) &
 		FETCH_PID=`ps -auwwwx | grep -v grep | grep "fetch -o ${_lf}" | awk '{print $2}'`
@@ -5267,7 +5268,8 @@
 				_dSize=`du -k ${_lf} | tr -d '\t' | cut -d '/' -f 1`
 				if [ $(is_num "$_dSize") ] ; then
 					if [ ${_fSize} -lt ${_dSize} ] ; then _dSize="$_fSize" ; fi
-					echo "SIZE: ${_fSize} DOWNLOADED: ${_dSize}"
+					_kbs=`expr ${_dSize} \/ $_time`
+					echo "SIZE: ${_fSize} DOWNLOADED: ${_dSize} SPEED: ${_kbs}KBs"
 				fi
 			fi
 
@@ -5275,6 +5277,7 @@
 			ps -p $FETCH_PID >/dev/null 2>/dev/null
 			if [ "$?" != "0" ] ; then break ; fi
 			sleep 2
+			_time=`expr $_time + 2`
 		done
 
 		_err="`cat ${_eFile}`"



More information about the Commits mailing list