deb-sahara/sahara/plugins/mapr/resources/install_scala.sh
Zhao Lei 6f728a44af Remove quotes from subshell call in install_scala.sh
Always no quotes for $() statement.

We don't need quotes to hold blanks in result:
 # i=$(echo 1 2 3)
 # echo $i
 1 2 3
 #

These quotes can make something wrong in some case:
 # i=$(echo '!')
 #
 # i="$(echo '!')"
 -bash: !: event not found
 #

 No real problem for current code in install_scala.sh, only to use a
 better code style.

Change-Id: Ia2370b8987ed121e5c44b3257cc7db42dd3390bb
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
2015-08-07 21:23:43 +08:00

28 lines
615 B
Bash

#!/bin/bash
#Current available version
DEF_VERSION="2.11.5"
VERSION=$(wget -qO- http://www.scala-lang.org|grep 'scala-version'|grep -Eo '([0-9]\.?)+')
if [ $? != 0 -o -z ${VERSION} ]; then
VERSION=${DEF_VERSION}
fi
PKG=scala-${VERSION}
URL="http://downloads.typesafe.com/scala/${VERSION}"
if [ "$1" = "Ubuntu" ]; then
wget -N ${URL}/${PKG}.deb
dpkg -i ${PKG}.deb
rm ${PKG}.deb
# install java if missing
apt-get install -f -y --force-yes
elif [ "$1" = 'CentOS' -o "$1" = 'RedHatEnterpriseServer' ]; then
rpm -Uhv ${URL}/${PKG}.rpm
else
echo "Unknown distribution"
exit 1
fi