Skip to content

Commit 7ad693f

Browse files
committed
chore(hadoop): Make the base url switchable
1 parent df33de7 commit 7ad693f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

hadoop/upload_new_hadoop_version.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ set -euo pipefail
55
VERSION=${1:?"Missing version number argument (arg 1)"}
66
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
77

8+
# We prefer fast downloads...
9+
BASE_DOWNLOAD_URL="https://dlcdn.apache.org/hadoop/common"
10+
# However, if the version is not available, use the slow archive instead:
11+
# BASE_DOWNLOAD_URL="https://archive.apache.org/dist/hadoop/common"
12+
813
read -r -s -p "Nexus Password: " NEXUS_PASSWORD
914
echo ""
1015

@@ -34,14 +39,14 @@ cd "$WORK_DIR" || exit
3439
bin_file=hadoop-$VERSION.tar.gz
3540
src_file=hadoop-$VERSION-src.tar.gz
3641

37-
echo "Downloading Hadoop"
38-
curl --fail -LO --progress-bar "https://dlcdn.apache.org/hadoop/common/hadoop-$VERSION/$bin_file"
39-
curl --fail -LO --progress-bar "https://dlcdn.apache.org/hadoop/common/hadoop-$VERSION/$bin_file.asc"
40-
curl --fail -LO --progress-bar "https://dlcdn.apache.org/hadoop/common/hadoop-$VERSION/$bin_file.sha512"
42+
echo "Downloading Hadoop (if this fails, try switching the BASE_DOWNLOAD_URL to the archive)"
43+
curl --fail -LO --progress-bar "${BASE_DOWNLOAD_URL}/hadoop-$VERSION/$bin_file"
44+
curl --fail -LO --progress-bar "${BASE_DOWNLOAD_URL}/hadoop-$VERSION/$bin_file.asc"
45+
curl --fail -LO --progress-bar "${BASE_DOWNLOAD_URL}/hadoop-$VERSION/$bin_file.sha512"
4146

42-
curl --fail -LO --progress-bar "https://dlcdn.apache.org/hadoop/common/hadoop-$VERSION/$src_file"
43-
curl --fail -LO --progress-bar "https://dlcdn.apache.org/hadoop/common/hadoop-$VERSION/$src_file.asc"
44-
curl --fail -LO --progress-bar "https://dlcdn.apache.org/hadoop/common/hadoop-$VERSION/$src_file.sha512"
47+
curl --fail -LO --progress-bar "${BASE_DOWNLOAD_URL}/hadoop-$VERSION/$src_file"
48+
curl --fail -LO --progress-bar "${BASE_DOWNLOAD_URL}/hadoop-$VERSION/$src_file.asc"
49+
curl --fail -LO --progress-bar "${BASE_DOWNLOAD_URL}/hadoop-$VERSION/$src_file.sha512"
4550

4651

4752
# It is probably redundant to check both the checksum and the signature but it's cheap and why not
@@ -53,7 +58,7 @@ if ! (sha512sum --tag "$bin_file" | diff - "$bin_file.sha512" && sha512sum --tag
5358
fi
5459

5560
echo "Validating signatures"
56-
echo '--> NOTE: Make sure you have downloaded and added the KEYS file (https://dlcdn.apache.org/hadoop/common/KEYS) to GPG: https://www.apache.org/info/verification.html (e.g. by using "curl https://dlcdn.apache.org/hadoop/common/KEYS | gpg --import")'
61+
echo "--> NOTE: Make sure you have downloaded and added the KEYS file (${BASE_DOWNLOAD_URL}/KEYS) to GPG: https://www.apache.org/info/verification.html (e.g. by using \"curl ${BASE_DOWNLOAD_URL}/KEYS | gpg --import\")"
5762

5863
if ! (gpg --verify "$bin_file.asc" "$bin_file" 2> /dev/null && gpg --verify "$src_file.asc" "$src_file" 2> /dev/null); then
5964
echo "ERROR: One of the signatures could not be verified"

0 commit comments

Comments
 (0)