diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -634,7 +634,6 @@ QUIETREDIR="/dev/stderr" QUIETFLAG=" " STATSREDIR="/dev/stderr" - DDSTATS=".." XARGST="-t" NDEBUG=" " ;; @@ -642,7 +641,6 @@ QUIETREDIR="" QUIETFLAG="" STATSREDIR="/dev/null" - DDSTATS=".." XARGST="" NDEBUG="" ;; @@ -650,7 +648,6 @@ QUIETREDIR="/dev/null" QUIETFLAG="-q" STATSREDIR="/dev/stdout" - DDSTATS="" XARGST="" NDEBUG="-n" ;; @@ -1188,16 +1185,21 @@ # Print user-friendly progress statistics fetch_progress () { + # Prompt + local FPMPT="$1" + # Total count + local FCNT=$2 LNC=0 + printf "%s... " "${FPMPT}" while read x; do - LNC=$(($LNC + 1)) - if [ $(($LNC % 10)) = 0 ]; then - echo -n $LNC - elif [ $(($LNC % 2)) = 0 ]; then - echo -n . + if [ "${VERBOSELEVEL}" != "nostats" ]; then + LNC=$(($LNC + 1)) + if [ $(($LNC % 2)) = 0 ]; then + printf "\r%s... %d/%d" "${FPMPT}" ${LNC} ${FCNT} + fi fi done - echo -n " " + printf "\r%s... done.\n" "${FPMPT}" } # Function for asking the user if everything is ok @@ -1440,13 +1442,12 @@ if [ -s patchlist ]; then # Attempt to fetch metadata patches - echo -n "Fetching `wc -l < patchlist | tr -d ' '` " - echo ${NDEBUG} "metadata patches.${DDSTATS}" + local _totalf=`wc -l < patchlist | tr -d ' '` + local _pmpt="Fetching ${_totalf} metadata patches" tr '|' '-' < patchlist | lam -s "${FETCHDIR}/tp/" - -s ".gz" | xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \ - 2>${STATSREDIR} | fetch_progress - echo "done." + 2>${STATSREDIR} | fetch_progress "${_pmpt}" ${_totalf} # Attempt to apply metadata patches echo -n "Applying metadata patches... " @@ -1979,13 +1980,12 @@ fetch_files () { # Attempt to fetch patches if [ -s patchlist ]; then - echo -n "Fetching `wc -l < patchlist | tr -d ' '` " - echo ${NDEBUG} "patches.${DDSTATS}" + local _totalf=`wc -l < patchlist | tr -d ' '` + local _pmpt="Fetching ${_totalf} patches" tr '|' '-' < patchlist | lam -s "${PATCHDIR}/" - | xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \ - 2>${STATSREDIR} | fetch_progress - echo "done." + 2>${STATSREDIR} | fetch_progress "${_pmpt}" ${_totalf} # Attempt to apply patches echo -n "Applying patches... " @@ -2013,12 +2013,13 @@ done < files.wanted > filelist if [ -s filelist ]; then - echo -n "Fetching `wc -l < filelist | tr -d ' '` " - echo ${NDEBUG} "files... " + local _totalf=`wc -l < filelist | tr -d ' '` + local _pmpt="Fetching ${_totalf} files" lam -s "${FETCHDIR}/f/" - -s ".gz" < filelist | xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \ - 2>${STATSREDIR} | fetch_progress + 2>${STATSREDIR} | fetch_progress "${_pmpt}" ${_totalf} + echo -n "Extracting patches and verifying checksums... " while read Y; do if ! [ -f ${Y}.gz ]; then echo "failed."