You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2009/12/30 00:17:14 UTC

svn commit: r894509 - in /hadoop/hbase/branches/0.20: CHANGES.txt bin/hbase-config.sh

Author: stack
Date: Tue Dec 29 23:17:13 2009
New Revision: 894509

URL: http://svn.apache.org/viewvc?rev=894509&view=rev
Log:
HBASE-2074 Improvements to the hadoop-config script

Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/bin/hbase-config.sh

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=894509&r1=894508&r2=894509&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Tue Dec 29 23:17:13 2009
@@ -61,6 +61,7 @@
                times
    HBASE-2062  Metrics documentation outdated (Lars George via JD)
    HBASE-2045  Update trunk and branch zk to just-release 3.2.2.
+   HBASE-2074  Improvements to the hadoop-config script (Bassam Tabbara via Stack)
 
 Release 0.20.2 - November 18th, 2009
   INCOMPATIBLE CHANGES

Modified: hadoop/hbase/branches/0.20/bin/hbase-config.sh
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/bin/hbase-config.sh?rev=894509&r1=894508&r2=894509&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/bin/hbase-config.sh (original)
+++ hadoop/hbase/branches/0.20/bin/hbase-config.sh Tue Dec 29 23:17:13 2009
@@ -44,7 +44,9 @@
 this="$bin/$script"
 
 # the root of the hbase installation
-export HBASE_HOME=`dirname "$this"`/..
+if [ -z "$HBASE_HOME" ]; then
+  export HBASE_HOME=`dirname "$this"`/..
+fi
 
 #check to see if the conf dir or hbase home are given as an optional arguments
 while [ $# -gt 1 ]
@@ -71,3 +73,33 @@
 HBASE_CONF_DIR="${HBASE_CONF_DIR:-$HBASE_HOME/conf}"
 # List of hbase regions servers.
 HBASE_REGIONSERVERS="${HBASE_REGIONSERVERS:-$HBASE_CONF_DIR/regionservers}"
+
+if [ -z "$JAVA_HOME" ]; then
+  for candidate in \
+    /usr/lib/jvm/java-6-sun \
+    /usr/lib/j2sdk1.6-sun \
+    /usr/java/jdk1.6* \
+    /usr/java/jre1.6* \
+    /Library/Java/Home ; do
+    if [ -e $candidate/bin/java ]; then
+      export JAVA_HOME=$candidate
+      break
+    fi
+  done
+  # if we didn't set it
+  if [ -z "$JAVA_HOME" ]; then
+    cat 1>&2 <<EOF
++======================================================================+
+|      Error: JAVA_HOME is not set and Java could not be found         |
++----------------------------------------------------------------------+
+| Please download the latest Sun JDK from the Sun Java web site        |
+|       > http://java.sun.com/javase/downloads/ <                      |
+|                                                                      |
+| HBase requires Java 1.6 or later.                                    |
+| NOTE: This script will find Sun Java whether you install using the   |
+|       binary or the RPM based installer.                             |
++======================================================================+
+EOF
+    exit 1
+  fi
+fi