blob: d2adffd04e34c1a05ebf2cc733857b6eed3e163d [file] [log] [blame]
buyingyi80bb3cc2013-04-25 00:17:23 -07001#!/bin/sh
2#
3#------------------------------------------------------------------------
4# Copyright 2009-2013 by The Regents of the University of California
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# you may obtain a copy of the License from
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# ------------------------------------------------------------------------
17#
18
19# resolve links - $0 may be a softlink
20PRG="$0"
21
22while [ -h "$PRG" ]; do
23 ls=`ls -ld "$PRG"`
24 link=`expr "$ls" : '.*-> \(.*\)$'`
25 if expr "$link" : '/.*' > /dev/null; then
26 PRG="$link"
27 else
28 PRG=`dirname "$PRG"`/"$link"
29 fi
30done
31
32PRGDIR=`dirname "$PRG"`
33BASEDIR=`cd "$PRGDIR/.." >/dev/null; pwd`
34
35
36
37# OS specific support. $var _must_ be set to either true or false.
38cygwin=false;
39darwin=false;
40case "`uname`" in
41 CYGWIN*) cygwin=true ;;
42 Darwin*) darwin=true
43 if [ -z "$JAVA_VERSION" ] ; then
44 JAVA_VERSION="CurrentJDK"
45 else
46 echo "Using Java version: $JAVA_VERSION"
47 fi
48 if [ -z "$JAVA_HOME" ] ; then
49 JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
50 fi
51 ;;
52esac
53
54if [ -z "$JAVA_HOME" ] ; then
55 if [ -r /etc/gentoo-release ] ; then
56 JAVA_HOME=`java-config --jre-home`
57 fi
58fi
59
60# For Cygwin, ensure paths are in UNIX format before anything is touched
61if $cygwin ; then
62 [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
63 [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
64fi
65
66# If a specific java binary isn't specified search for the standard 'java' binary
67if [ -z "$JAVACMD" ] ; then
68 if [ -n "$JAVA_HOME" ] ; then
69 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
70 # IBM's JDK on AIX uses strange locations for the executables
71 JAVACMD="$JAVA_HOME/jre/sh/java"
72 else
73 JAVACMD="$JAVA_HOME/bin/java"
74 fi
75 else
76 JAVACMD=`which java`
77 fi
78fi
79
80if [ ! -x "$JAVACMD" ] ; then
81 echo "Error: JAVA_HOME is not defined correctly." 1>&2
82 echo " We cannot execute $JAVACMD" 1>&2
83 exit 1
84fi
85
86if [ -z "$REPO" ]
87then
88 REPO="$BASEDIR"/lib
89fi
90
91CLASSPATH=$CLASSPATH_PREFIX:"$HADOOP_HOME"/conf:/etc/hadoop/conf:"$BASEDIR"/etc:$1
92
93#add the desired hive patch
94CLASSPATH=${CLASSPATH}:${REPO}/a-hive-patch.jar
95
96#add the desired jetty jar
97for f in ${REPO}/servlet-api-3*.jar; do
98 CLASSPATH=${CLASSPATH}:$f;
99done
100
101for f in ${REPO}/*.jar; do
102 CLASSPATH=${CLASSPATH}:$f;
103done
104
105# For Cygwin, switch paths to Windows format before running java
106if $cygwin; then
107 [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
108 [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
109 [ -n "$HOME" ] && HOME=`cygpath --path --windows "$HOME"`
110 [ -n "$BASEDIR" ] && BASEDIR=`cygpath --path --windows "$BASEDIR"`
111 [ -n "$REPO" ] && REPO=`cygpath --path --windows "$REPO"`
112fi
113
114exec "$JAVACMD" $JAVA_OPTS \
115 -classpath "$CLASSPATH" \
116 -Dapp.name="hivesterixcc" \
117 -Dapp.pid="$$" \
118 -Dapp.repo="$REPO" \
119 -Dapp.home="$BASEDIR" \
120 -Dbasedir="$BASEDIR" \
121 edu.uci.ics.hyracks.control.cc.CCDriver \
122 "$@"