diff options
author | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
commit | 3028e3f8aba938dfd0bf9fda987b8a72140b8027 (patch) | |
tree | b2f038222ff8a70f687652441df00d2b564c8abe /usr.sbin/portsnap | |
parent | 952a6d5a7cd3d3f9007acfa06805262fc04a105f (diff) | |
parent | 1d08d5f677c1dfa810e381073590adbae19cc69f (diff) | |
download | FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.zip FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.tar.gz |
Sync with HEAD.
Diffstat (limited to 'usr.sbin/portsnap')
-rw-r--r-- | usr.sbin/portsnap/portsnap/portsnap.sh | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index ed9c28d..f9f4716 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -612,6 +612,28 @@ fetch_progress() { echo -n " " } +pct_fmt() +{ + printf " \r" + printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc` +} + +fetch_progress_percent() { + TOTAL=$1 + LNC=0 + pct_fmt $LNC $TOTAL + while read x; do + LNC=$(($LNC + 1)) + if [ $(($LNC % 100)) = 0 ]; then + pct_fmt $LNC $TOTAL + elif [ $(($LNC % 10)) = 0 ]; then + echo -n . + fi + done + pct_fmt $LNC $TOTAL + echo " done. " +} + # Sanity-check an index file fetch_index_sanity() { if grep -qvE "^[-_+./@0-9A-Za-z]+\|[0-9a-f]{64}$" INDEX.new || @@ -781,11 +803,13 @@ fetch_update() { echo " done." 1>${QUIETREDIR} # Attempt to fetch ports patches - echo -n "Fetching `wc -l < patchlist | tr -d ' '` " + patchcnt=`wc -l < patchlist | tr -d ' '` + echo -n "Fetching $patchcnt " echo ${NDEBUG} "patches.${DDSTATS}" + echo " " tr '|' '-' < patchlist | lam -s "bp/" - | xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \ - 2>${STATSREDIR} | fetch_progress + 2>${STATSREDIR} | fetch_progress_percent $patchcnt echo "done." # Attempt to apply ports patches |