1
1
#! /usr/bin/env bash
2
2
3
+ set -euo pipefail
4
+
3
5
VERSION=${1:? " Missing version number argument (arg 1)" }
4
6
NEXUS_USER=${2:? " Missing Nexus username argument (arg 2)" }
5
7
@@ -15,13 +17,13 @@ WORK_DIR=$(mktemp -d -p "$DIR")
15
17
16
18
# check if tmp dir was created
17
19
if [[ ! " $WORK_DIR " || ! -d " $WORK_DIR " ]]; then
18
- echo " Could not create temp dir"
19
- exit 1
20
+ echo " Could not create temp dir"
21
+ exit 1
20
22
fi
21
23
22
24
# deletes the temp directory
23
25
function cleanup {
24
- rm -rf " $WORK_DIR "
26
+ rm -rf " $WORK_DIR "
25
27
}
26
28
27
29
# register the cleanup function to be called on the EXIT signal
@@ -39,16 +41,16 @@ curl --fail -LOs "https://archive.apache.org/dist/spark/spark-${VERSION}/${src_f
39
41
# It is probably redundant to check both the checksum and the signature but it's cheap and why not
40
42
echo " Validating SHA512 Checksum"
41
43
if ! (sha512sum " ${src_file} " | diff - " ${src_file} .sha512" ); then
42
- echo " ERROR: The SHA512 sum does not match"
43
- exit 1
44
+ echo " ERROR: The SHA512 sum does not match"
45
+ exit 1
44
46
fi
45
47
46
48
echo " Validating signature"
47
49
echo ' --> NOTE: Make sure you have downloaded and added the KEYS file (https://archive.apache.org/dist/spark/KEYS) to GPG: https://www.apache.org/info/verification.html (e.g. by using "curl https://archive.apache.org/dist/spark/KEYS | gpg --import")'
48
50
49
51
if ! (gpg --verify " ${src_file} .asc" " ${src_file} " 2> /dev/null); then
50
- echo " ERROR: The signature could not be verified"
51
- exit 1
52
+ echo " ERROR: The signature could not be verified"
53
+ exit 1
52
54
fi
53
55
54
56
echo " Uploading everything to Nexus"
@@ -58,8 +60,8 @@ curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}.asc" 'ht
58
60
curl --fail -u " $NEXUS_USER :$NEXUS_PASSWORD " --upload-file " ${src_file} .sha512" ' https://repo.stackable.tech/repository/packages/spark/' || EXIT_STATUS=$?
59
61
60
62
if [ $EXIT_STATUS -ne 0 ]; then
61
- echo " ERROR: Upload failed"
62
- exit 1
63
+ echo " ERROR: Upload failed"
64
+ exit 1
63
65
fi
64
66
65
67
echo " Successfully uploaded version ${VERSION} of Spark to Nexus"
0 commit comments