diff --git a/scripts/hunspell.sh b/scripts/hunspell.sh index 0de9f02..3a69faa 100644 --- a/scripts/hunspell.sh +++ b/scripts/hunspell.sh @@ -6,7 +6,9 @@ function action3_hunspell () if test -f "$hunspell_zip_file"; then echo File $hunspell_zip_file already exists. else - curl -L "$hunspell_link" > $hunspell_zip_file + try_download "$hunspell_link" "$hunspell_zip_file" \ + && test -f "$hunspell_zip_file" \ + && unzip -t "$hunspell_zip_file" if test "$?" != 0; then echo Unable to download Hunspell from echo " $hunspell_link" diff --git a/scripts/tools.sh b/scripts/tools.sh index d4167a2..2a21c34 100644 --- a/scripts/tools.sh +++ b/scripts/tools.sh @@ -186,3 +186,18 @@ function prepare_build_dir () mkdir -p "$build_dir" fi } + +function try_download () +{ + local url="$1" + local destination="$2" + local attempts="$3" + if [ -z "$attempts" ]; then + attempts=3 + fi + while [ $attempts -gt 0 ]; then + curl --progress-bar --retry 3 --output "$destination" "$url" && return 0 + attempts=$(($attempts - 1)) + fi + return -1 +}