[66] | 1 | #!/usr/bin/env bash |
---|
| 2 | |
---|
| 3 | # Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 4 | # contributor license agreements. See the NOTICE file distributed with |
---|
| 5 | # this work for additional information regarding copyright ownership. |
---|
| 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 7 | # (the "License"); you may not use this file except in compliance with |
---|
| 8 | # the License. You may obtain a copy of the License at |
---|
| 9 | # |
---|
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 11 | # |
---|
| 12 | # Unless required by applicable law or agreed to in writing, software |
---|
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 15 | # See the License for the specific language governing permissions and |
---|
| 16 | # limitations under the License. |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | # The Hadoop record compiler |
---|
| 20 | # |
---|
| 21 | # Environment Variables |
---|
| 22 | # |
---|
| 23 | # JAVA_HOME The java implementation to use. Overrides JAVA_HOME. |
---|
| 24 | # |
---|
| 25 | # HADOOP_OPTS Extra Java runtime options. |
---|
| 26 | # |
---|
| 27 | # HADOOP_CONF_DIR Alternate conf dir. Default is ${HADOOP_HOME}/conf. |
---|
| 28 | # |
---|
| 29 | |
---|
| 30 | bin=`dirname "$0"` |
---|
| 31 | bin=`cd "$bin"; pwd` |
---|
| 32 | |
---|
| 33 | . "$bin"/hadoop-config.sh |
---|
| 34 | |
---|
| 35 | if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then |
---|
| 36 | . "${HADOOP_CONF_DIR}/hadoop-env.sh" |
---|
| 37 | fi |
---|
| 38 | |
---|
| 39 | # some Java parameters |
---|
| 40 | if [ "$JAVA_HOME" != "" ]; then |
---|
| 41 | #echo "run java in $JAVA_HOME" |
---|
| 42 | JAVA_HOME=$JAVA_HOME |
---|
| 43 | fi |
---|
| 44 | |
---|
| 45 | if [ "$JAVA_HOME" = "" ]; then |
---|
| 46 | echo "Error: JAVA_HOME is not set." |
---|
| 47 | exit 1 |
---|
| 48 | fi |
---|
| 49 | |
---|
| 50 | JAVA=$JAVA_HOME/bin/java |
---|
| 51 | JAVA_HEAP_MAX=-Xmx1000m |
---|
| 52 | |
---|
| 53 | # CLASSPATH initially contains $HADOOP_CONF_DIR |
---|
| 54 | CLASSPATH="${HADOOP_CONF_DIR}" |
---|
| 55 | CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar |
---|
| 56 | |
---|
| 57 | # for developers, add Hadoop classes to CLASSPATH |
---|
| 58 | if [ -d "$HADOOP_HOME/build/classes" ]; then |
---|
| 59 | CLASSPATH=${CLASSPATH}:$HADOOP_HOME/build/classes |
---|
| 60 | fi |
---|
| 61 | if [ -d "$HADOOP_HOME/build/webapps" ]; then |
---|
| 62 | CLASSPATH=${CLASSPATH}:$HADOOP_HOME/build |
---|
| 63 | fi |
---|
| 64 | if [ -d "$HADOOP_HOME/build/test/classes" ]; then |
---|
| 65 | CLASSPATH=${CLASSPATH}:$HADOOP_HOME/build/test/classes |
---|
| 66 | fi |
---|
| 67 | |
---|
| 68 | # so that filenames w/ spaces are handled correctly in loops below |
---|
| 69 | IFS= |
---|
| 70 | |
---|
| 71 | # for releases, add core hadoop jar & webapps to CLASSPATH |
---|
| 72 | if [ -d "$HADOOP_HOME/webapps" ]; then |
---|
| 73 | CLASSPATH=${CLASSPATH}:$HADOOP_HOME |
---|
| 74 | fi |
---|
| 75 | for f in $HADOOP_HOME/hadoop-*-core.jar; do |
---|
| 76 | CLASSPATH=${CLASSPATH}:$f; |
---|
| 77 | done |
---|
| 78 | |
---|
| 79 | # add libs to CLASSPATH |
---|
| 80 | for f in $HADOOP_HOME/lib/*.jar; do |
---|
| 81 | CLASSPATH=${CLASSPATH}:$f; |
---|
| 82 | done |
---|
| 83 | |
---|
| 84 | for f in $HADOOP_HOME/lib/jetty-ext/*.jar; do |
---|
| 85 | CLASSPATH=${CLASSPATH}:$f; |
---|
| 86 | done |
---|
| 87 | |
---|
| 88 | # restore ordinary behaviour |
---|
| 89 | unset IFS |
---|
| 90 | |
---|
| 91 | CLASS='org.apache.hadoop.record.compiler.generated.Rcc' |
---|
| 92 | |
---|
| 93 | # cygwin path translation |
---|
| 94 | if expr `uname` : 'CYGWIN*' > /dev/null; then |
---|
| 95 | CLASSPATH=`cygpath -p -w "$CLASSPATH"` |
---|
| 96 | fi |
---|
| 97 | |
---|
| 98 | # run it |
---|
| 99 | exec "$JAVA" $HADOOP_OPTS -classpath "$CLASSPATH" $CLASS "$@" |
---|