diff options
author | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2023-03-29 12:04:54 +0000 |
---|---|---|
committer | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2023-09-13 06:44:02 +0000 |
commit | 620666bce4b837f971491f3f6ce486e98a2559b5 (patch) | |
tree | 6e473f48d4364ddafd69a0b39756924769e2e927 /coin/provisioning/common/unix/DownloadURL.sh | |
parent | ddef5cc5f2cbaea7e9f9c5ef843cffcfabac384a (diff) |
Fix shellcheck complaints about provisioning scripts
Also adds executable attributes to shell scripts that were missing it.
Change-Id: Id52ef495147fdbfb5cb1a1f711fac530e0e85f3b
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'coin/provisioning/common/unix/DownloadURL.sh')
-rwxr-xr-x | coin/provisioning/common/unix/DownloadURL.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/coin/provisioning/common/unix/DownloadURL.sh b/coin/provisioning/common/unix/DownloadURL.sh index 909e9942..7ee92646 100755 --- a/coin/provisioning/common/unix/DownloadURL.sh +++ b/coin/provisioning/common/unix/DownloadURL.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (C) 2019 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 @@ -21,9 +21,12 @@ 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" + if command -v curl >/dev/null + then + curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" + else + wget --tries 5 -O "$targetFile" "$url" + fi } VerifyHash () { @@ -61,10 +64,10 @@ DownloadURL () { url2=$2 expectedHash=$3 # Optional argument $4: destination filename - if [ x"$4" = x ] + if [ -z "$4" ] then # defaults to the last component of $url - targetFile=$(echo $url | sed 's|^.*/||') + targetFile="${url/*\//}" else targetFile=$4 fi |