diff options
author | Dimitrios Apostolou <jimis@qt.io> | 2020-02-07 15:59:00 +0100 |
---|---|---|
committer | Dimitrios Apostolou <jimis@qt.io> | 2020-02-15 07:38:41 +0100 |
commit | fc2d0b5150045d525c5ff629564baaa4f9ecb535 (patch) | |
tree | 61edf69db59804593f0dabd7c703489163bc3a30 | |
parent | b018b841c1ce49b412fa981a65b90a4778e933de (diff) |
Create more meaningful temporary file names
Change-Id: I4bbc94993e51502ea08109a4c99f3e212349ab24
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
-rwxr-xr-x | coin/provisioning/common/macos/InstallPKGFromURL.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/coin/provisioning/common/macos/InstallPKGFromURL.sh b/coin/provisioning/common/macos/InstallPKGFromURL.sh index 77ef128a..d9b55d3b 100755 --- a/coin/provisioning/common/macos/InstallPKGFromURL.sh +++ b/coin/provisioning/common/macos/InstallPKGFromURL.sh @@ -42,7 +42,9 @@ function InstallPKGFromURL { targetDirectory=$4 echo "Creating temporary file" - targetFile=$(mktemp "$TMPDIR$(uuidgen).pkg") + 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" @@ -50,10 +52,12 @@ function InstallPKGFromURL { 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 "$expectedSha1 *$targetFile" > "$targetFile".sha1 + /usr/bin/shasum --check "$targetFile".sha1 echo "Run installer on PKG" sudo installer -package "$targetFile" -target "$targetDirectory" - echo "Removing file '$targetFile'" - rm "$targetFile" + + rm -f "$targetFile".sha1 + rm -f "$targetFile" + rmdir "$tmpdir" } |