You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/06/25 04:32:50 UTC

git commit: Autodetect JAVA_HOME on RPM-based systems

Repository: spark
Updated Branches:
  refs/heads/master 133495d82 -> 54055fb2b


Autodetect JAVA_HOME on RPM-based systems

Author: Matthew Farrellee <ma...@redhat.com>

Closes #1185 from mattf/master-1 and squashes the following commits:

42150fc [Matthew Farrellee] Autodetect JAVA_HOME on RPM-based systems


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/54055fb2
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/54055fb2
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/54055fb2

Branch: refs/heads/master
Commit: 54055fb2b73a545e7cca6c645356ef287aa5a7c4
Parents: 133495d
Author: Matthew Farrellee <ma...@redhat.com>
Authored: Tue Jun 24 19:31:20 2014 -0700
Committer: Patrick Wendell <pw...@gmail.com>
Committed: Tue Jun 24 19:32:33 2014 -0700

----------------------------------------------------------------------
 make-distribution.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/54055fb2/make-distribution.sh
----------------------------------------------------------------------
diff --git a/make-distribution.sh b/make-distribution.sh
index 6f708e0..8686843 100755
--- a/make-distribution.sh
+++ b/make-distribution.sh
@@ -85,6 +85,17 @@ while (( "$#" )); do
 done
 
 if [ -z "$JAVA_HOME" ]; then
+  # Fall back on JAVA_HOME from rpm, if found
+  if which rpm &>/dev/null; then
+    RPM_JAVA_HOME=$(rpm -E %java_home 2>/dev/null)
+    if [ "$RPM_JAVA_HOME" != "%java_home" ]; then
+      JAVA_HOME=$RPM_JAVA_HOME
+      echo "No JAVA_HOME set, proceeding with '$JAVA_HOME' learned from rpm"
+    fi
+  fi
+fi
+
+if [ -z "$JAVA_HOME" ]; then
   echo "Error: JAVA_HOME is not set, cannot proceed."
   exit -1
 fi