[PC-BSD Commits] r17384 - pcbsd/current/src-sh/pbi-manager
svn at pcbsd.org
svn at pcbsd.org
Sat Jun 23 06:41:11 PDT 2012
Author: kris
Date: 2012-06-23 13:41:08 +0000 (Sat, 23 Jun 2012)
New Revision: 17384
Modified:
pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:
New feature for pbi-manager, now when we download PBIs,
we will use fetch resume support automatically.
Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager 2012-06-22 13:07:12 UTC (rev 17383)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager 2012-06-23 13:41:08 UTC (rev 17384)
@@ -5310,7 +5310,7 @@
local _CKSUM="$2"
# Set local download location
- _dl_loc="${PBI_APPDIR}/.`basename $PBI_UPFILE`.$$"
+ _dl_loc="${PBI_APPDIR}/.`basename $PBI_UPFILE`"
# Have a patch file to download instead, make that the active file to try
if [ -n "$_tPatch" ] ; then
@@ -5354,14 +5354,13 @@
_rf="${1}"
_lf="${2}"
- # Wait a sec
- sleep 1
-
init_tmpdir
- if [ -e "${_lf}" ] ; then rm "$_lf" ; fi
+ if [ -e "${_lf}" ] ; then
+ echo "Resuming download of: ${_lf}"
+ fi
if [ "$PBI_FETCH_PARSING" != "YES" ] ; then
- fetch -o "${_lf}" "${_rf}"
+ fetch -r -o "${_lf}" "${_rf}"
_err=$?
else
# Doing a front-end download, parse the output of fetch
@@ -5370,13 +5369,11 @@
_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
+ _time=1
- ( 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}'`
- FETCH_TFILE="${_lf}"
- while
- z=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`
@@ -5396,7 +5393,7 @@
_err="`cat ${_eFile}`"
if [ "$_err" = "0" ]; then echo "FETCHDONE" ; fi
- unset FETCH_PID FETCH_TFILE
+ unset FETCH_PID
fi
echo ""
@@ -6703,9 +6700,8 @@
# If a download is running, kill it
if [ -n "${FETCH_PID}" ] ; then
echo "Killing ${FETCH_PID}"
- kill -9 ${FETCH_PID}
- sleep 1
- rm ${FETCH_TFILE}
+ kill -s INT ${FETCH_PID}
+ sleep 2
fi
chroot_make_cleanup
rm_tmpdir
More information about the Commits
mailing list