File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -383,17 +383,21 @@ fn_fetch_file() {
383
383
fi
384
384
# Trap will remove part downloaded files if canceled.
385
385
trap fn_fetch_trap INT
386
- # Larger files show a progress bar.
387
- if [ " ${local_filename ##* .} " == " bz2 " ] || [ " ${local_filename ##* .} " == " gz " ] || [ " ${local_filename ##* .} " == " zip " ] || [ " ${local_filename ##* .} " == " jar " ] || [ " ${local_filename ##* .} " == " xz " ] ; then
388
- echo -e " downloading ${local_filename} ... "
389
- fn_sleep_time
390
- curlcmd= $( curl --connect-timeout 10 --progress-bar --fail -L -o " ${local_filedir} / ${local_filename} " " ${fileurl} " )
391
- local exitcode= $?
386
+ curlcmd=(curl --connect-timeout 10 --fail -L -o " ${local_filedir} / ${local_filename} " --retry 2)
387
+
388
+ # if is large file show progress, else be silent
389
+ local exitcode= " "
390
+ large_files=( " bz2 " " gz " " zip " " jar " " xz " )
391
+ if grep -qE " (^|\s) ${local_filename ##* .} (\s|$) " <<< " ${large_files[@]} " ; then
392
392
echo -en " downloading ${local_filename} ..."
393
+ fn_sleep_time
394
+ echo -en " \033[1K"
395
+ " ${curlcmd[@]} " --progress-bar " ${fileurl} " 2>&1
396
+ exitcode=" $? "
393
397
else
394
- curlcmd=$( curl --connect-timeout 10 -s --fail -L -o " ${local_filedir} /${local_filename} " " ${fileurl} " )
395
- local exitcode=$?
396
398
echo -en " fetching ${fileurl_name} ${local_filename} ...\c"
399
+ " ${curlcmd[@]} " --silent --show-error " ${fileurl} " 2>&1
400
+ exitcode=" $? "
397
401
fi
398
402
399
403
# Download will fail if downloads a html file.
You can’t perform that action at this time.
0 commit comments