buyingyi | 80bb3cc | 2013-04-25 00:17:23 -0700 | [diff] [blame^] | 1 | #!/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 |
| 20 | PRG="$0" |
| 21 | |
| 22 | while [ -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 |
| 30 | done |
| 31 | |
| 32 | PRGDIR=`dirname "$PRG"` |
| 33 | BASEDIR=`cd "$PRGDIR/.." >/dev/null; pwd` |
| 34 | |
| 35 | |
| 36 | |
| 37 | # OS specific support. $var _must_ be set to either true or false. |
| 38 | cygwin=false; |
| 39 | darwin=false; |
| 40 | case "`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 | ;; |
| 52 | esac |
| 53 | |
| 54 | if [ -z "$JAVA_HOME" ] ; then |
| 55 | if [ -r /etc/gentoo-release ] ; then |
| 56 | JAVA_HOME=`java-config --jre-home` |
| 57 | fi |
| 58 | fi |
| 59 | |
| 60 | # For Cygwin, ensure paths are in UNIX format before anything is touched |
| 61 | if $cygwin ; then |
| 62 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
| 63 | [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` |
| 64 | fi |
| 65 | |
| 66 | # If a specific java binary isn't specified search for the standard 'java' binary |
| 67 | if [ -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 |
| 78 | fi |
| 79 | |
| 80 | if [ ! -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 |
| 84 | fi |
| 85 | |
| 86 | if [ -z "$REPO" ] |
| 87 | then |
| 88 | REPO="$BASEDIR"/lib |
| 89 | fi |
| 90 | |
| 91 | CLASSPATH=$CLASSPATH_PREFIX:"$HADOOP_HOME"/conf:/etc/hadoop/conf:"$BASEDIR"/etc:$1 |
| 92 | |
| 93 | #add the desired hive patch |
| 94 | CLASSPATH=${CLASSPATH}:${REPO}/a-hive-patch.jar |
| 95 | |
| 96 | #add the desired jetty jar |
| 97 | for f in ${REPO}/servlet-api-3*.jar; do |
| 98 | CLASSPATH=${CLASSPATH}:$f; |
| 99 | done |
| 100 | |
| 101 | for f in ${REPO}/*.jar; do |
| 102 | CLASSPATH=${CLASSPATH}:$f; |
| 103 | done |
| 104 | |
| 105 | # For Cygwin, switch paths to Windows format before running java |
| 106 | if $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"` |
| 112 | fi |
| 113 | |
| 114 | exec "$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 | "$@" |