diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-03-23 13:13:46 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-03-23 13:13:46 -0500 |
commit | 1d9d6413c8c75459f2cb47c150479fad546d55fb (patch) | |
tree | 14613c5d851f0683aff30e033553f69b43061e35 /download.sh | |
parent | 742b7072210b04e1b69bdd1936f8c8b86a098216 (diff) |
Cleanup download.sh
Diffstat (limited to 'download.sh')
-rw-r--r-- | download.sh | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/download.sh b/download.sh index 4154c75..179990d 100644 --- a/download.sh +++ b/download.sh @@ -1,21 +1,23 @@ -# Packages +#!/bin/bash + +# Downlod Packages and Patches download() { tput civis local url=$1 echo -n " " - wget -nc -q --show-progress --progress=dot $url 2>&1 | grep --line-buffered "%" | \ + 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)" - URL="$(echo $line | cut -d\, -f3 | sed "s/@/${VERSION}/g")" - MD5SUM="$(echo $line | cut -d\, -f4)" +cat packages.csv patches.csv | while read -r line; do + #NAME="$(echo "$line" | cut -d\, -f1)" + VERSION="$(echo "$line" | cut -d\, -f2)" + URL="$(echo "$line" | cut -d\, -f3 | sed "s/@/${VERSION}/g")" + MD5SUM="$(echo "$line" | cut -d\, -f4)" CACHEFILE="$(basename "${URL}")" if [ ! -f "${CACHEFILE}" ]; then @@ -23,7 +25,7 @@ cat packages.csv patches.csv | while read line; do echo -ne "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... " #wget -nc ${URL} -O ${LFS}/sources/${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} + download "${URL}" if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then rm -f "${LFS}/sources/${CACHEFILE}" echo -e "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}" |