From 78050805bc691a00788f6e51f23dd785ca25b227 Mon Sep 17 00:00:00 2001 From: Jey Kottalam Date: Sat, 8 Feb 2014 12:24:08 -0800 Subject: 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 == Merge branch commits == commit 6c600eb434a2f3e7d70b67831aeebde9b5c0f43b Author: Jey Kottalam Date: Fri Jan 17 10:43:54 2014 -0800 Make sbt download an atomic operation --- sbt/sbt | 5 +++-- 1 file 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 -- cgit v1.2.3