1+ # shellcheck shell=bash disable=SC2148
12# shellcheck source=./ftp-url.sh
23source " ${OPENCOARRAYS_SRC_DIR} /prerequisites/build-functions/ftp-url.sh"
34# shellcheck source=./set_SUDO_if_needed_to_write_to_directory.sh
@@ -12,14 +13,18 @@ download_if_necessary()
1213 if [[ -f " ${download_path} /${url_tail} " || -d " ${download_path} /${url_tail} " ]] ; then
1314 info " Found '${url_tail} ' in ${download_path} ."
1415 info " If it resulted from an incomplete download, building ${package_name} could fail."
15- info " Would you like to proceed anyway? (Y/n)"
16- read -r proceed
17- if [[ " ${proceed} " == " n" || " ${proceed} " == " N" || " ${proceed} " == " no" ]]; then
18- info " n"
19- info " Please remove $url_tail and restart the installation to to ensure a fresh download." 1>&2
20- emergency " Aborting. [exit 80]"
16+ if [[ " ${arg_y} " == " ${__flag_present} " ]]; then
17+ info " -y or --yes-to-all flag present. Proceeding with non-interactive build."
2118 else
22- info " y"
19+ info " Would you like to proceed anyway? (Y/n)"
20+ read -r proceed
21+ if [[ " ${proceed} " == " n" || " ${proceed} " == " N" || " ${proceed} " == " no" ]]; then
22+ info " n"
23+ info " Please remove $url_tail and restart the installation to to ensure a fresh download." 1>&2
24+ emergency " Aborting. [exit 80]"
25+ else
26+ info " y"
27+ fi
2328 fi
2429 elif ! type " ${fetch} " & > /dev/null; then
2530 # The download mechanism is missing
@@ -45,9 +50,9 @@ download_if_necessary()
4550 args=" clone"
4651 elif [[ " ${fetch} " == " curl" ]]; then
4752 first_three_characters=$( echo " ${package_url} " | cut -c1-3)
48- if [[ " ${first_three_characters} " == " ftp" ]]; then
53+ if [[ " ${first_three_characters} " == " ftp" ]]; then
4954 args=" -LO -u anonymous:"
50- elif [[ " ${first_three_characters} " == " htt" ]]; then
55+ elif [[ " ${first_three_characters} " == " htt" ]]; then
5156 args=" -LO"
5257 else
5358 emergency " download_if_necessary.sh: Unrecognized URL."
@@ -64,7 +69,8 @@ download_if_necessary()
6469 info " Download command: \" ${fetch} \" ${args:- } ${package_url} "
6570 info " Depending on the file size and network bandwidth, this could take several minutes or longer."
6671 pushd " ${download_path} "
67- " ${fetch} " ${args:- } ${package_url}
72+ # args should be an array. Then "${args[@]:-}" will prevent shellcheck from complaining
73+ " ${fetch} " ${args:- } " ${package_url} "
6874 popd
6975 if [[ ! -z " ${arg_B:- } " ]]; then
7076 return
0 commit comments