[PC-BSD Commits] r19037 - pcbsd/current/src-sh/pc-metapkgmanager

svn at pcbsd.org svn at pcbsd.org
Tue Sep 11 07:55:16 PDT 2012


Author: kris
Date: 2012-09-11 14:55:16 +0000 (Tue, 11 Sep 2012)
New Revision: 19037

Modified:
   pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager
Log:

Switch pc-metapkgmanager to use the new functions.sh file



Modified: pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager
===================================================================
--- pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2012-09-11 14:54:02 UTC (rev 19036)
+++ pcbsd/current/src-sh/pc-metapkgmanager/pc-metapkgmanager	2012-09-11 14:55:16 UTC (rev 19037)
@@ -24,6 +24,9 @@
 # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
+# Source our functions
+. /usr/local/share/pcbsd/scripts/functions.sh
+
 # Define some defaults
 DBDIR="/var/db/pc-metapkgmanager/pkgsets"
 LOGFILE="/tmp/.pc-metapkgmanager.log"
@@ -776,74 +779,6 @@
   rm /tmp/.pc-meta-sort.$$
 }
 
-# Function to download a file from remote using fetch
-get_file() {
-	_rf="${1}"
-	_lf="${2}"
-        _ftries=${3}
-	if [ -z "$_ftries" ] ; then _ftries=3; fi
-
-	if [ -e "${_lf}" ] ; then 
-		echo "Resuming download of: ${_lf}"
-	fi
-
-	if [ "$GUI_FETCH_PARSING" != "YES" ] ; then
-		fetch -r -o "${_lf}" "${_rf}"
-		_err=$?
-	else
-		# Doing a front-end download, parse the output of fetch
-		_eFile="/tmp/.fetch-exit.$$"
-		fetch -s "${_rf}" > /tmp/.fetch-size.$$ 2>/dev/null
-		_fSize=`cat /tmp/.fetch-size.$$ 2>/dev/null`
-		_fSize="`expr ${_fSize} / 1024 2>/dev/null`"
-		rm "/tmp/.fetch-size.$$" 2>/dev/null
-		_time=1
-
-		( fetch -r -o "${_lf}" "${_rf}" >/dev/null 2>/dev/null ; echo "$?" > ${_eFile} ) &
-		FETCH_PID=`ps -auwwwx | grep -v grep | grep "fetch -r -o ${_lf}" | awk '{print $2}'`
-		while : 
-		do
-			if [ -e "${_lf}" ] ; then
-				_dSize=`du -k ${_lf} | tr -d '\t' | cut -d '/' -f 1`
-				if [ $(is_num "$_dSize") ] ; then
-					if [ ${_fSize} -lt ${_dSize} ] ; then _dSize="$_fSize" ; fi
-					_kbs=`expr ${_dSize} \/ $_time`
-					echo "SIZE: ${_fSize} DOWNLOADED: ${_dSize} SPEED: ${_kbs} KB/s"
-				fi
-			fi
-
-			# Make sure download isn't finished
-			ps -p $FETCH_PID >/dev/null 2>/dev/null
-			if [ "$?" != "0" ] ; then break ; fi
-			sleep 2
-			_time=`expr $_time + 2`
-		done
-
-		_err="`cat ${_eFile}`"
-		if [ "$_err" = "0" ]; then echo "FETCHDONE" ; fi
-		unset FETCH_PID
-	fi
-
-	echo ""
-	if [ $_err -ne 0 -a $_ftries -gt 0 ] ; then
-		sleep 30
-		_ftries=`expr $_ftries - 1`
-
-		# Remove the local file if we failed
-		if [ -e "${_lf}" ]; then rm "${_lf}"; fi
-
-		get_file "${_rf}" "${_lf}" $_ftries	
-		_err=$?
-	fi
-	return $_err
-}
-
-is_num()
-{
-        expr $1 + 1 2>/dev/null
-        return $?
-}
-
 # Unset some vars
 _chroot=""
 _chrootcmd=""



More information about the Commits mailing list