diff --git a/elements/hadoop-mapr/README.rst b/elements/hadoop-mapr/README.rst index bb26ac3e..267a5129 100644 --- a/elements/hadoop-mapr/README.rst +++ b/elements/hadoop-mapr/README.rst @@ -37,3 +37,8 @@ DIB_MAPR_VERSION :Required: Yes :Description: Version of MapR to install. :Example: ``DIB_MAPR_VERSION=5.2.0`` + +SCALA_VERSION + :Required: No + :Description: Force a specific version of Scala (disable autodetection). + :Example: ``SCALA_VERSION=2.12.2`` diff --git a/elements/hadoop-mapr/install.d/41-scala b/elements/hadoop-mapr/install.d/41-scala index 399107ad..c1454e6a 100755 --- a/elements/hadoop-mapr/install.d/41-scala +++ b/elements/hadoop-mapr/install.d/41-scala @@ -17,11 +17,13 @@ if [ "$RETURN_CODE" != "200" ]; then echo "http://www.scala-lang.org is unreachable" && exit 1 fi -if [ "trusty" == "${DIB_RELEASE:-}" ]; then +if [ -n "${SCALA_VERSION:-}" ]; then + VERSION=${SCALA_VERSION} +elif [ "trusty" == "${DIB_RELEASE:-}" ]; then # scale >= 2.12 for ubuntu depends on openjdk-8, not available on trusty VERSION=${DEF_VERSION} else - VERSION="$(curl -s --fail http://www.scala-lang.org|grep 'scala-version'|grep -Eo '([0-9]\.?)+')" + VERSION="$(curl -s --fail http://www.scala-lang.org| tr -d '\n' | sed 's/^.*[^0-9]\+\([0-9\.\?]\+\)<.\+$/\1/')" if [ $? != 0 -o -z "${VERSION}" ]; then echo "Installing default version $DEF_VERSION" @@ -31,7 +33,7 @@ fi PKG=scala-${VERSION} -URL="http://downloads.typesafe.com/scala/${VERSION}" +URL="http://downloads.lightbend.com/scala/${VERSION}" if [ "$DISTRO_NAME" = "ubuntu" ]; then wget -N ${URL}/${PKG}.deb