|
20 | 20 | # This script loads spark-env.sh if it exists, and ensures it is only loaded once. |
21 | 21 | # spark-env.sh is loaded from SPARK_CONF_DIR if set, or within the current directory's |
22 | 22 | # conf/ subdirectory. |
23 | | -FWDIR="$(cd "`dirname "$0"`"/..; pwd)" |
| 23 | + |
| 24 | +# Figure out where Spark is installed |
| 25 | +if [ -z "${SPARK_HOME}" ]; then |
| 26 | + export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)" |
| 27 | +fi |
24 | 28 |
|
25 | 29 | if [ -z "$SPARK_ENV_LOADED" ]; then |
26 | 30 | export SPARK_ENV_LOADED=1 |
27 | 31 |
|
28 | 32 | # Returns the parent of the directory this script lives in. |
29 | | - parent_dir="$(cd "`dirname "$0"`"/..; pwd)" |
| 33 | + parent_dir="${SPARK_HOME}" |
30 | 34 |
|
31 | 35 | user_conf_dir="${SPARK_CONF_DIR:-"$parent_dir"/conf}" |
32 | 36 |
|
|
42 | 46 |
|
43 | 47 | if [ -z "$SPARK_SCALA_VERSION" ]; then |
44 | 48 |
|
45 | | - ASSEMBLY_DIR2="$FWDIR/assembly/target/scala-2.11" |
46 | | - ASSEMBLY_DIR1="$FWDIR/assembly/target/scala-2.10" |
| 49 | + ASSEMBLY_DIR2="${SPARK_HOME}/assembly/target/scala-2.11" |
| 50 | + ASSEMBLY_DIR1="${SPARK_HOME}/assembly/target/scala-2.10" |
47 | 51 |
|
48 | | - if [[ -d "$ASSEMBLY_DIR2" && -d "$ASSEMBLY_DIR1" ]]; then |
49 | | - echo -e "Presence of build for both scala versions(SCALA 2.10 and SCALA 2.11) detected." 1>&2 |
50 | | - echo -e 'Either clean one of them or, export SPARK_SCALA_VERSION=2.11 in spark-env.sh.' 1>&2 |
51 | | - exit 1 |
52 | | - fi |
| 52 | + if [[ -d "$ASSEMBLY_DIR2" && -d "$ASSEMBLY_DIR1" ]]; then |
| 53 | + echo -e "Presence of build for both scala versions(SCALA 2.10 and SCALA 2.11) detected." 1>&2 |
| 54 | + echo -e 'Either clean one of them or, export SPARK_SCALA_VERSION=2.11 in spark-env.sh.' 1>&2 |
| 55 | + exit 1 |
| 56 | + fi |
53 | 57 |
|
54 | | - if [ -d "$ASSEMBLY_DIR2" ]; then |
55 | | - export SPARK_SCALA_VERSION="2.11" |
56 | | - else |
57 | | - export SPARK_SCALA_VERSION="2.10" |
58 | | - fi |
| 58 | + if [ -d "$ASSEMBLY_DIR2" ]; then |
| 59 | + export SPARK_SCALA_VERSION="2.11" |
| 60 | + else |
| 61 | + export SPARK_SCALA_VERSION="2.10" |
| 62 | + fi |
59 | 63 | fi |
0 commit comments