mirror of
git://code.qt.io/qt/qt5.git
synced 2026-02-24 16:05:36 +08:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user