diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2017-09-20 11:01:28 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2017-09-20 11:01:28 -0400 |
commit | cd96d96c6f43f971c688620f7f8dee2d262c81a5 (patch) | |
tree | b631a765ea14779e84f46eceb3bc9a40ba6fbe60 | |
parent | c3b7abbbbcb2b1fa4fa2698e77e9457b7af638a7 (diff) | |
download | librebootfr-cd96d96c6f43f971c688620f7f8dee2d262c81a5.tar.gz librebootfr-cd96d96c6f43f971c688620f7f8dee2d262c81a5.zip |
Conditionally use wget or curl in download_wrapper
-rwxr-xr-x | libs/common | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/common b/libs/common index 8dff9d18..db72a974 100755 --- a/libs/common +++ b/libs/common @@ -91,7 +91,21 @@ download_wrapper() { '--' ) - wget "${wget_options[@]}" "${uris[@]}" + if hash wget > /dev/null 2>&1; then + + wget "${wget_options[@]}" "${uris[@]}" + + elif hash curl > /dev/null 2>&1; then + ( + cd "$download_dir" + + curl "${curl_options[@]}" "${uris[@]}" + ) + else + printf '\n%s\n\n' 'Error: Neither wget nor curl were found' 1>&2 + + return 1 + fi } diff_patch_file() { |