Fix (again) the detection of scala version (now https)

The www.scala-lang.org switched to https and the curl call did not
account for this scenario, so it failed.
Switch the address to https and as extra measure add also the -L
argument, which forces curl to follow the redirects.

Switch also the download URL to https.

Story: 2001964
Task: 15089
Change-Id: I82d3dd0bd000284fb5404483bf3ee34a6fbb147b
(cherry picked from commit 30717f2516)
This commit is contained in:
Luigi Toscano 2018-05-04 17:55:50 +02:00
parent cd0668fe9e
commit 40b4553dde
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@ Creates images with local mirrors of MapR repositories:
`core <http://package.mapr.com/releases/>`_ and
`ecosystem <http://package.mapr.com/releases/ecosystem-4.x/>`_.
Installs `OpenJDK <http://http://openjdk.java.net/>`_ and
`Scala <http://www.scala-lang.org/>`_.
`Scala <https://www.scala-lang.org/>`_.
In order to create the MapR images with ``diskimage-create.sh``, use the
following syntax to select the ``MapR`` plugin:

View File

@ -11,10 +11,10 @@ echo "START: installing Scala"
#Current available version
DEF_VERSION="2.11.6"
RETURN_CODE="$(curl -s -o /dev/null -w "%{http_code}" http://www.scala-lang.org/)"
RETURN_CODE="$(curl -s -L -o /dev/null -w "%{http_code}" https://www.scala-lang.org/)"
if [ "$RETURN_CODE" != "200" ]; then
echo "http://www.scala-lang.org is unreachable" && exit 1
echo "https://www.scala-lang.org is unreachable" && exit 1
fi
if [ -n "${SCALA_VERSION:-}" ]; then
@ -23,7 +23,7 @@ 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| tr -d '\n' | sed 's/^.*<div[^<]\+scala-version">[^0-9]\+\([0-9\.\?]\+\)<.\+$/\1/')"
VERSION="$(curl -s -L --fail https://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 $DEF_VERSION"
@ -33,7 +33,7 @@ fi
PKG=scala-${VERSION}
URL="http://downloads.lightbend.com/scala/${VERSION}"
URL="https://downloads.lightbend.com/scala/${VERSION}"
if [ "$DISTRO_NAME" = "ubuntu" ]; then
wget -N ${URL}/${PKG}.deb