libreboot

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 33efc3a00d4443ecb713bf230ee7ba65b701b55b
parent ca3e4a475d4fafb36e09c358c4ba86ee4e87bce0
Author: Swift Geek <swiftgeek@gmail.com>
Date:   Wed, 20 Sep 2017 15:03:58 +0000

Merge branch 'download-wrapper' of kragle/libreboot into master

Diffstat:
libs/common | 40+++++++++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/libs/common b/libs/common @@ -73,17 +73,39 @@ download_wrapper() { shift local uris=($@) - # TODO: Add support for curl, in addition - # to wget, for compatibility reasons - wget_options=( - --config=/dev/null - --secure-protocol=PFS - --directory-prefix="${download_dir}" - --continue - -- + local wget_options=( + '--config=/dev/null' + '--secure-protocol=PFS' + "--directory-prefix=$download_dir" + '--continue' + '--' ) - wget "${wget_options[@]}" "${uris[@]}" + local curl_options=( + '-q' + '--continue-at -' + '--remote-name' + '--retry 20' + '--ssl' + '--tlsv1.2' + '--' + ) + + 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() {