aboutsummaryrefslogtreecommitdiff
path: root/sbt
diff options
context:
space:
mode:
authorJey Kottalam <jey@cs.berkeley.edu>2014-02-08 12:24:08 -0800
committerPatrick Wendell <pwendell@gmail.com>2014-02-08 12:24:08 -0800
commit78050805bc691a00788f6e51f23dd785ca25b227 (patch)
tree85665acd2307b8d039ae6a9cf0d2be1f2ee16468 /sbt
parentfabf1749995103841e6a3975892572f376ee48d0 (diff)
downloadspark-78050805bc691a00788f6e51f23dd785ca25b227.tar.gz
spark-78050805bc691a00788f6e51f23dd785ca25b227.tar.bz2
spark-78050805bc691a00788f6e51f23dd785ca25b227.zip
Merge pull request #454 from jey/atomic-sbt-download. Closes #454.
Make sbt download an atomic operation Modifies the `sbt/sbt` script to gracefully recover when a previous invocation died in the middle of downloading the SBT jar. Author: Jey Kottalam <jey@cs.berkeley.edu> == Merge branch commits == commit 6c600eb434a2f3e7d70b67831aeebde9b5c0f43b Author: Jey Kottalam <jey@cs.berkeley.edu> Date: Fri Jan 17 10:43:54 2014 -0800 Make sbt download an atomic operation
Diffstat (limited to 'sbt')
-rwxr-xr-xsbt/sbt5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbt/sbt b/sbt/sbt
index 62ead8a69d..8472dce589 100755
--- a/sbt/sbt
+++ b/sbt/sbt
@@ -29,10 +29,11 @@ JAR=sbt/sbt-launch-${SBT_VERSION}.jar
if [ ! -f ${JAR} ]; then
# Download
printf "Attempting to fetch sbt\n"
+ JAR_DL=${JAR}.part
if hash curl 2>/dev/null; then
- curl --progress-bar ${URL1} > ${JAR} || curl --progress-bar ${URL2} > ${JAR}
+ (curl --progress-bar ${URL1} > ${JAR_DL} || curl --progress-bar ${URL2} > ${JAR_DL}) && mv ${JAR_DL} ${JAR}
elif hash wget 2>/dev/null; then
- wget --progress=bar ${URL1} -O ${JAR} || wget --progress=bar ${URL2} -O ${JAR}
+ (wget --progress=bar ${URL1} -O ${JAR_DL} || wget --progress=bar ${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