aboutsummaryrefslogtreecommitdiff
path: root/run
diff options
context:
space:
mode:
authorThomas Dudziak <tomdzk@gmail.com>2012-10-22 13:10:47 -0700
committerThomas Dudziak <tomdzk@gmail.com>2012-10-22 13:11:05 -0700
commitf595bb53d17d1ff84453214376445ae3c82c1222 (patch)
tree141687ec3af37ce0201c9b1f41e94a881e8c2811 /run
parent0967e71a004d2b723d1e66e3dbc62a12726bbb94 (diff)
downloadspark-f595bb53d17d1ff84453214376445ae3c82c1222.tar.gz
spark-f595bb53d17d1ff84453214376445ae3c82c1222.tar.bz2
spark-f595bb53d17d1ff84453214376445ae3c82c1222.zip
Tweaked run file to live more happily with typesafe's debian package
Diffstat (limited to 'run')
-rwxr-xr-xrun43
1 files changed, 30 insertions, 13 deletions
diff --git a/run b/run
index 15db23bbe0..83175e84de 100755
--- a/run
+++ b/run
@@ -13,10 +13,33 @@ if [ -e $FWDIR/conf/spark-env.sh ] ; then
. $FWDIR/conf/spark-env.sh
fi
-# Check that SCALA_HOME has been specified
-if [ -z "$SCALA_HOME" ]; then
- echo "SCALA_HOME is not set" >&2
- exit 1
+if [ "$SPARK_LAUNCH_WITH_SCALA" == "1" ]; then
+ if [ `command -v scala` ]; then
+ RUNNER="scala"
+ else
+ if [ -z "$SCALA_HOME" ]; then
+ echo "SCALA_HOME is not set" >&2
+ exit 1
+ fi
+ RUNNER="${SCALA_HOME}/bin/scala"
+ fi
+else
+ if [ `command -v java` ]; then
+ RUNNER="java"
+ else
+ if [ -z "$JAVA_HOME" ]; then
+ echo "JAVA_HOME is not set" >&2
+ exit 1
+ fi
+ RUNNER="${JAVA_HOME}/bin/java"
+ fi
+ if [ -z "$SCALA_LIBRARY_PATH" ]; then
+ if [ -z "$SCALA_HOME" ]; then
+ echo "SCALA_HOME is not set" >&2
+ exit 1
+ fi
+ SCALA_LIBRARY_PATH="$SCALA_HOME/lib"
+ fi
fi
# Figure out how much memory to use per executor and set it as an environment
@@ -70,17 +93,11 @@ export CLASSPATH # Needed for spark-shell
# the Spark shell, the wrapper is necessary to properly reset the terminal
# when we exit, so we allow it to set a variable to launch with scala.
if [ "$SPARK_LAUNCH_WITH_SCALA" == "1" ]; then
- RUNNER="${SCALA_HOME}/bin/scala"
EXTRA_ARGS="" # Java options will be passed to scala as JAVA_OPTS
else
- CLASSPATH+=":$SCALA_HOME/lib/scala-library.jar"
- CLASSPATH+=":$SCALA_HOME/lib/scala-compiler.jar"
- CLASSPATH+=":$SCALA_HOME/lib/jline.jar"
- if [ -n "$JAVA_HOME" ]; then
- RUNNER="${JAVA_HOME}/bin/java"
- else
- RUNNER=java
- fi
+ CLASSPATH+=":$SCALA_LIBRARY_PATH/scala-library.jar"
+ CLASSPATH+=":$SCALA_LIBRARY_PATH/scala-compiler.jar"
+ CLASSPATH+=":$SCALA_LIBRARY_PATH/jline.jar"
# The JVM doesn't read JAVA_OPTS by default so we need to pass it in
EXTRA_ARGS="$JAVA_OPTS"
fi