aboutsummaryrefslogtreecommitdiffstats
path: root/coin
diff options
context:
space:
mode:
authorDimitrios Apostolou <jimis@qt.io>2019-09-20 13:00:12 +0200
committerDimitrios Apostolou <jimis@qt.io>2019-09-27 08:42:49 +0200
commit4e3a0f79fbe8bea7915b267e132ba1e0d4b67733 (patch)
treec51c0113a64f3fda105f93347be1411a2ab7a0ce /coin
parent8f4c12bc03f2617d499c45b342474eef7337f1a0 (diff)
DownloadURL now works with either wget or curl
The reason is that Ubuntu does not have curl at the very beginning of provisioning scripts, and also does not have the repositories configured in order to install it. Change-Id: Ia485c1672f894bc800f199b742d238b2945938e5 Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Diffstat (limited to 'coin')
-rwxr-xr-xcoin/provisioning/common/unix/DownloadURL.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/coin/provisioning/common/unix/DownloadURL.sh b/coin/provisioning/common/unix/DownloadURL.sh
index da6d772f..0579451f 100755
--- a/coin/provisioning/common/unix/DownloadURL.sh
+++ b/coin/provisioning/common/unix/DownloadURL.sh
@@ -46,6 +46,15 @@ command -v sha512sum >/dev/null || alias sha512sum='shasum -a 512'
########################################################################
+Download () {
+ url="$1"
+ targetFile="$2"
+
+ command -v curl >/dev/null \
+ && curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" \
+ || wget --tries 5 -O "$targetFile" "$url"
+}
+
VerifyHash () {
file=$1
expectedHash=$2
@@ -87,10 +96,10 @@ DownloadURL () {
echo "Skipping download, found and validated existing file: $targetFile"
else
echo "Downloading from primary URL: $url"
- if ! curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url"
+ if ! Download "$url" "$targetFile"
then
echo "FAIL! to download, trying alternative URL: $url2" 1>&2
- if ! curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url2"
+ if ! Download "$url" "$targetFile"
then
echo 'FAIL! to download even from alternative url' 1>&2
return 1