Files
qt5/coin/provisioning/common/macos/InstallPKGFromURL.sh
Lucie Gérard f477802046 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Task-number: QTBUG-108364
Change-Id: If26e4d35c780db4a7982bb84872b251dad24716e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit eecfb19548)
2023-09-11 12:18:35 +02:00

33 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (C) 2017 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
set -ex
function InstallPKGFromURL {
url=$1
url_alt=$2
expectedSha1=$3
targetDirectory=$4
echo "Creating temporary file"
package_basename=$(echo "$url" | sed 's|^.*/||')
tmpdir=$(mktemp -d)
targetFile="$tmpdir/$package_basename"
echo "Downloading PKG from primary URL '$url'"
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" || (
echo "Failed to download '$url' multiple times"
echo "Downloading PKG from alternative URL '$url_alt'"
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url_alt"
)
echo "Checking SHA1 on PKG '$targetFile'"
echo "$expectedSha1 *$targetFile" > "$targetFile".sha1
/usr/bin/shasum --check "$targetFile".sha1
echo "Run installer on PKG"
sudo installer -package "$targetFile" -target "$targetDirectory"
rm -f "$targetFile".sha1
rm -f "$targetFile"
rmdir "$tmpdir"
}