cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [2/6] cassandra git commit: Make sstablemetadata work outside install dir
Date Mon, 12 Jan 2015 17:52:44 GMT
Make sstablemetadata work outside install dir

patch by Jimmy Mårdell; reviewed by yukim for CASSANDRA-8579


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9e5a4fad
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9e5a4fad
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9e5a4fad

Branch: refs/heads/cassandra-2.1
Commit: 9e5a4fad7d8421837cb32aabd643b6ac7f9e62b6
Parents: c20d415
Author: Jimmy Mårdell <yarin@spotify.com>
Authored: Fri Jan 9 16:35:13 2015 -0600
Committer: Yuki Morishita <yukim@apache.org>
Committed: Mon Jan 12 11:50:25 2015 -0600

----------------------------------------------------------------------
 tools/bin/sstablemetadata | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e5a4fad/tools/bin/sstablemetadata
----------------------------------------------------------------------
diff --git a/tools/bin/sstablemetadata b/tools/bin/sstablemetadata
index 5fe8cc4..5e7c26a 100755
--- a/tools/bin/sstablemetadata
+++ b/tools/bin/sstablemetadata
@@ -16,29 +16,32 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-if [ "x$CLASSPATH" = "x" ]; then
-    
-    # execute from the build dir.
-    if [ -d `dirname $0`/../../build/classes ]; then
-        for directory in `dirname $0`/../../build/classes/*; do
-            CLASSPATH=$CLASSPATH:$directory
-        done
-    else
-        if [ -f `dirname $0`/../lib/stress.jar ]; then
-            CLASSPATH=`dirname $0`/../lib/stress.jar
+if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+    for include in "`dirname "$0"`/cassandra.in.sh" \
+                   "$HOME/.cassandra.in.sh" \
+                   /usr/share/cassandra/cassandra.in.sh \
+                   /usr/local/share/cassandra/cassandra.in.sh \
+                   /opt/cassandra/cassandra.in.sh; do
+        if [ -r "$include" ]; then
+            . "$include"
+            break
         fi
-    fi
-
-    for jar in `dirname $0`/../../lib/*.jar; do
-        CLASSPATH=$CLASSPATH:$jar
     done
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
+
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    JAVA="`which java`"
+fi
+
+if [ -z "$CLASSPATH" ]; then
+    echo "You must set the CLASSPATH var" >&2
+    exit 1
 fi
 
 $JAVA -cp $CLASSPATH \


Mime
View raw message