aboutsummaryrefslogtreecommitdiff
path: root/build/sbt-launch-lib.bash
diff options
context:
space:
mode:
authorCheng Lian <lian@databricks.com>2015-07-22 09:32:42 -0700
committerYin Huai <yhuai@databricks.com>2015-07-22 09:32:42 -0700
commitb55a36bc30a628d76baa721d38789fc219eccc27 (patch)
tree05e71fbb7f585b51e674700301fe51df0ac7f3b6 /build/sbt-launch-lib.bash
parentc03299a18b4e076cabb4b7833a1e7632c5c0dabe (diff)
downloadspark-b55a36bc30a628d76baa721d38789fc219eccc27.tar.gz
spark-b55a36bc30a628d76baa721d38789fc219eccc27.tar.bz2
spark-b55a36bc30a628d76baa721d38789fc219eccc27.zip
[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 <lian@databricks.com> Closes #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
Diffstat (limited to 'build/sbt-launch-lib.bash')
-rwxr-xr-xbuild/sbt-launch-lib.bash8
1 files changed, 6 insertions, 2 deletions
diff --git a/build/sbt-launch-lib.bash b/build/sbt-launch-lib.bash
index 504be48b35..7930a38b96 100755
--- a/build/sbt-launch-lib.bash
+++ b/build/sbt-launch-lib.bash
@@ -51,9 +51,13 @@ acquire_sbt_jar () {
printf "Attempting to fetch sbt\n"
JAR_DL="${JAR}.part"
if [ $(command -v curl) ]; then
- (curl --silent ${URL1} > "${JAR_DL}" || curl --silent ${URL2} > "${JAR_DL}") && mv "${JAR_DL}" "${JAR}"
+ (curl --fail --location --silent ${URL1} > "${JAR_DL}" ||\
+ (rm -f "${JAR_DL}" && curl --fail --location --silent ${URL2} > "${JAR_DL}")) &&\
+ mv "${JAR_DL}" "${JAR}"
elif [ $(command -v wget) ]; then
- (wget --quiet ${URL1} -O "${JAR_DL}" || wget --quiet ${URL2} -O "${JAR_DL}") && mv "${JAR_DL}" "${JAR}"
+ (wget --quiet ${URL1} -O "${JAR_DL}" ||\
+ (rm -f "${JAR_DL}" && wget --quiet ${URL2} -O "${JAR_DL}")) &&\
+ mv "${JAR_DL}" "${JAR}"
else
printf "You do not have curl or wget installed, please install sbt manually from http://www.scala-sbt.org/\n"
exit -1