From 8f0f88fbb420053e84a16d4408d9d768e000e2fc Mon Sep 17 00:00:00 2001 From: William Harrington Date: Sun, 21 Mar 2021 10:59:36 -0500 Subject: Show only percentage at end of downloading line. --- download.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'download.sh') diff --git a/download.sh b/download.sh index 9c610ff..b8a0c11 100755 --- a/download.sh +++ b/download.sh @@ -1,6 +1,18 @@ #!/bin/bash # Packages + +download() +{ + tput civis + local url=$1 + echo -n " " + wget -nc -q --show-progress --progress=dot $url 2>&1 | grep --line-buffered "%" | \ + sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}' + echo -ne "\b\b\b\b\n" + tput cnorm +} + cat packages.csv patches.csv | while read line; do NAME="$(echo $line | cut -d\, -f1)" VERSION="$(echo $line | cut -d\, -f2)" @@ -12,14 +24,12 @@ cat packages.csv patches.csv | while read line; do echo -ne "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... " - wget -nc -q -O "${LFS_SRC}/${CACHEFILE}" "${URL}" & pid=$! - spinner "$pid" - if ! echo "${MD5SUM} ${LFS_SRC}/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then + #wget -nc ${URL} -O ${LFS_SRC}/${CACHEFILE} --progress=dot -q --show-progress 2>&1 | awk 'NF>2 && $(NF-2) ~ /%/{printf "\r \t\t\t\t\t\t%s",$(NF-2)} END{print "\r "}' + download ${URL} + if ! echo "${MD5SUM} ${LFS_SRC}/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then rm -f "${LFS_SRC}/${CACHEFILE}" echo -e "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}" exit 1 fi - - echo -e "${GRN}OK${RST}" fi -done \ No newline at end of file +done -- cgit v1.2.3-54-g00ecf