aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Sarajärvi <tony.sarajarvi@qt.io>2017-09-21 08:24:45 +0300
committerTony Sarajärvi <tony.sarajarvi@qt.io>2017-09-30 12:21:16 +0000
commit2a650c49eedbb6d2647f38bba8efdb2379f3a692 (patch)
treeed9d6770f1b2851925e2960883f8a13725a70b5f
parentcda49ad060055a48d0e15bb5a4eb269c9f5e4491 (diff)
Provisioning: Fix usage of DownloadURL to throw errors
In case DownloadURL failed it's shasum check, it printed an error and threw an exit 1. This exit 1 was never handled in the calling scripts and went ignored. It was also not passed forward as it was inside a try-catch statement. Change-Id: Iae4fd6aefb75c07623ec86dc570f0a46fec659b4 Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
-rw-r--r--coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh6
-rw-r--r--coin/provisioning/common/InstallFromCompressedFileFromURL.sh6
2 files changed, 10 insertions, 2 deletions
diff --git a/coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh b/coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh
index bee16dd2..2af2db10 100644
--- a/coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh
+++ b/coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh
@@ -42,6 +42,7 @@ source "${BASH_SOURCE%/*}/try_catch.sh"
# shellcheck source=DownloadURL.sh
source "${BASH_SOURCE%/*}/DownloadURL.sh"
+ExceptionDownload=99
ExceptionCreateTmpFile=100
ExceptionCreateTmpDirectory=101
ExceptionUncompress=102
@@ -80,7 +81,7 @@ function InstallAppFromCompressedFileFromURL {
else
targetDirectory=$(mktemp -d) || throw $ExceptionCreateTmpDirectory
fi
- DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile"
+ (DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile") || throw $ExceptionDownload
echo "Uncompress $targetFile"
case $extension in
"tar.gz")
@@ -103,6 +104,9 @@ function InstallAppFromCompressedFileFromURL {
catch || {
case $ex_code in
+ $ExceptionDownload)
+ exit 1;
+ ;;
$ExceptionCreateTmpFile)
echo "Failed to create temporary file"
exit 1;
diff --git a/coin/provisioning/common/InstallFromCompressedFileFromURL.sh b/coin/provisioning/common/InstallFromCompressedFileFromURL.sh
index e3716597..df84431a 100644
--- a/coin/provisioning/common/InstallFromCompressedFileFromURL.sh
+++ b/coin/provisioning/common/InstallFromCompressedFileFromURL.sh
@@ -38,6 +38,7 @@ source "${BASH_SOURCE%/*}/try_catch.sh"
# shellcheck source=DownloadURL.sh
source "${BASH_SOURCE%/*}/DownloadURL.sh"
+ExceptionDownload=99
ExceptionCreateTmpFile=100
ExceptionCreateTmpDirectory=101
ExceptionUncompress=102
@@ -66,7 +67,7 @@ function InstallFromCompressedFileFromURL {
echo "Creating temporary file and directory"
targetFile=$(mktemp "$TMPDIR$(uuidgen)XXXXX.$extension") || throw $ExceptionCreateTmpFile
targetDirectory=$(mktemp -d) || throw $ExceptionCreateTmpDirectory
- DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile"
+ (DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile") || throw $ExceptionDownload
echo "Uncompress $targetFile"
case $extension in
"tar.gz")
@@ -90,6 +91,9 @@ function InstallFromCompressedFileFromURL {
catch || {
case $ex_code in
+ $ExceptionDownload)
+ exit 1;
+ ;;
$ExceptionCreateTmpFile)
echo "Failed to create temporary file"
exit 1;