|
|
@@ -383,17 +383,21 @@ fn_fetch_file() {
|
|
|
fi
|
|
|
# Trap will remove part downloaded files if canceled.
|
|
|
trap fn_fetch_trap INT
|
|
|
- # Larger files show a progress bar.
|
|
|
- if [ "${local_filename##*.}" == "bz2" ] || [ "${local_filename##*.}" == "gz" ] || [ "${local_filename##*.}" == "zip" ] || [ "${local_filename##*.}" == "jar" ] || [ "${local_filename##*.}" == "xz" ]; then
|
|
|
- echo -e "downloading ${local_filename}..."
|
|
|
- fn_sleep_time
|
|
|
- curlcmd=$(curl --connect-timeout 10 --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}")
|
|
|
- local exitcode=$?
|
|
|
+ curlcmd=(curl --connect-timeout 10 --fail -L -o "${local_filedir}/${local_filename}" --retry 2)
|
|
|
+
|
|
|
+ # if is large file show progress, else be silent
|
|
|
+ local exitcode=""
|
|
|
+ large_files=("bz2" "gz" "zip" "jar" "xz")
|
|
|
+ if grep -qE "(^|\s)${local_filename##*.}(\s|$)" <<< "${large_files[@]}"; then
|
|
|
echo -en "downloading ${local_filename}..."
|
|
|
+ fn_sleep_time
|
|
|
+ echo -en "\033[1K"
|
|
|
+ "${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1
|
|
|
+ exitcode="$?"
|
|
|
else
|
|
|
- curlcmd=$(curl --connect-timeout 10 -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}")
|
|
|
- local exitcode=$?
|
|
|
echo -en "fetching ${fileurl_name} ${local_filename}...\c"
|
|
|
+ "${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1
|
|
|
+ exitcode="$?"
|
|
|
fi
|
|
|
|
|
|
# Download will fail if downloads a html file.
|