Skip to content

Commit b55a36b

Browse files
lianchengyhuai
authored andcommitted
[SPARK-9254] [BUILD] [HOTFIX] sbt-launch-lib.bash should support HTTP/HTTPS redirection
Target file(s) can be hosted on CDN nodes. HTTP/HTTPS redirection must be supported to download these files. Author: Cheng Lian <[email protected]> Closes apache#7597 from liancheng/spark-9254 and squashes the following commits: fd266ca [Cheng Lian] Uses `--fail' to make curl return non-zero value and remove garbage output when the download fails a7cbfb3 [Cheng Lian] Supports HTTP/HTTPS redirection
1 parent c03299a commit b55a36b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

build/sbt-launch-lib.bash

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ acquire_sbt_jar () {
5151
printf "Attempting to fetch sbt\n"
5252
JAR_DL="${JAR}.part"
5353
if [ $(command -v curl) ]; then
54-
(curl --silent ${URL1} > "${JAR_DL}" || curl --silent ${URL2} > "${JAR_DL}") && mv "${JAR_DL}" "${JAR}"
54+
(curl --fail --location --silent ${URL1} > "${JAR_DL}" ||\
55+
(rm -f "${JAR_DL}" && curl --fail --location --silent ${URL2} > "${JAR_DL}")) &&\
56+
mv "${JAR_DL}" "${JAR}"
5557
elif [ $(command -v wget) ]; then
56-
(wget --quiet ${URL1} -O "${JAR_DL}" || wget --quiet ${URL2} -O "${JAR_DL}") && mv "${JAR_DL}" "${JAR}"
58+
(wget --quiet ${URL1} -O "${JAR_DL}" ||\
59+
(rm -f "${JAR_DL}" && wget --quiet ${URL2} -O "${JAR_DL}")) &&\
60+
mv "${JAR_DL}" "${JAR}"
5761
else
5862
printf "You do not have curl or wget installed, please install sbt manually from http://www.scala-sbt.org/\n"
5963
exit -1

0 commit comments

Comments
 (0)