Refactor web_get() and add progress

This commit is contained in:
Martin Wimpress 2021-09-27 22:47:10 +01:00
parent 3a86f6c2dd
commit 0dcbe75fb5
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
1 changed files with 4 additions and 6 deletions

View File

@ -5,12 +5,10 @@ function web_get() {
local URL="${1}"
local FILE=""
FILE="${URL##*/}"
if [ ! -e "${VMDIR}/${FILE}" ]; then
mkdir -p "${VMDIR}" 2>/dev/null
if ! wget -q -c "${URL}" -O "${VMDIR}/${FILE}"; then
echo "ERROR! Failed to download ${URL}"
exit 1
fi
mkdir -p "${VMDIR}" 2>/dev/null
if ! wget --quiet --continue --show-progress --progress=bar:force:noscroll "${URL}" -O "${VMDIR}/${FILE}"; then
echo "ERROR! Failed to download ${URL}"
exit 1
fi
}