Merge "Adding ntpdate and Scala to mapr image"

This commit is contained in:
Zuul 2018-04-20 13:18:01 +00:00 committed by Gerrit Code Review
commit ca0c116a98
3 changed files with 33 additions and 27 deletions

View File

@ -2,7 +2,7 @@
echo "START: installing Scala"
sudo yum -y update
exit 0
DEF_VERSION="2.11.6"
if [ $test_only -eq 0 ]; then
@ -12,14 +12,14 @@ if [ $test_only -eq 0 ]; then
echo "http://www.scala-lang.org is unreachable" && exit 1
fi
if [ -n "${scala_version:-}" ]; then
if [ "${scala_version}" != "1" ]; then
VERSION=$scala_version
else
VERSION="$(curl -s --fail http://www.scala-lang.org| tr -d '\n' | sed 's/^.*<div[^<]\+scala-version">[^0-9]\+\([0-9\.\?]\+\)<.\+$/\1/')"
if [ $? != 0 -o -z "${VERSION}" ]; then
echo "Installing default version $scala_version"
VERSION=$scala_version
echo "Installing default version $DEF_VERSION"
VERSION=${DEF_VERSION}
fi
fi

View File

@ -11,8 +11,10 @@ arguments:
hidden: True
required: False
scala_version:
default: 2.11.6
description: The version of scala to install. Defaults to 2.11.6.
default: 1
description: The version of scala to install. Defaults to 1 to indicate
that the value should be autodetected or fallback to well
known version.
hidden: True
required: False
hdfs_lib_dir:
@ -84,6 +86,8 @@ validators:
- mesa-private-llvm
- mysql-connector-java
- nmap-ncat
- ntp
- ntpdate
- numactl
- openjpeg-libs
- patch

View File

@ -1,34 +1,36 @@
#!/bin/bash
echo "START: installing Scala"
DEF_VERSION="2.11.6"
if [ $test_only -eq 0 ]; then
RETURN_CODE="$(curl -s -o /dev/null -w "%{http_code}" http://www.scala-lang.org/)"
if [ "$RETURN_CODE" != "200" ]; then
echo "http://www.scala-lang.org is unreachable" && exit 1
fi
RETURN_CODE="$(curl -s -o /dev/null -w "%{http_code}" http://www.scala-lang.org/)"
if [ "$RETURN_CODE" != "200" ]; then
echo "http://www.scala-lang.org is unreachable" && exit 1
fi
if [ -n "${scala_version:-}" ]; then
VERSION=$scala_version
else
VERSION="$(curl -s --fail http://www.scala-lang.org| tr -d '\n' | sed 's/^.*<div[^<]\+scala-version">[^0-9]\+\([0-9\.\?]\+\)<.\+$/\1/')"
if [ $? != 0 -o -z "${VERSION}" ]; then
echo "Installing default version $scala_version"
if [ $(lsb_release -c -s) == "trusty" ]; then
VERSION=${DEF_VERSION}
else
if [ "${scala_version}" != "1" ]; then
VERSION=$scala_version
fi
fi
else
VERSION="$(curl -s --fail http://www.scala-lang.org| tr -d '\n' | sed 's/^.*<div[^<]\+scala-version">[^0-9]\+\([0-9\.\?]\+\)<.\+$/\1/')"
PKG=scala-${VERSION}
if [ $? != 0 -o -z "${VERSION}" ]; then
echo "Installing default version $DEF_VERSION"
VERSION=${DEF_VERSION}
fi
fi
fi
URL="http://downloads.lightbend.com/scala/${VERSION}"
PKG=scala-${VERSION}
wget -N ${URL}/${PKG}.deb
dpkg -i ${PKG}.deb
rm ${PKG}.deb
URL="http://downloads.lightbend.com/scala/${VERSION}"
wget -N ${URL}/${PKG}.deb
dpkg -i ${PKG}.deb
rm ${PKG}.deb
fi
echo "END: installing Scala"