mirror of
https://github.com/apache/sqoop.git
synced 2025-05-02 07:21:58 +08:00

From: Aaron Kimball <aaron@cloudera.com> git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149911 13f79535-47bb-0310-9956-ffa450edef68
76 lines
2.2 KiB
Bash
Executable File
76 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Licensed to Cloudera, Inc. under one or more
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
# this work for additional information regarding copyright ownership.
|
|
# Cloudera, Inc. licenses this file to You under the Apache License, Version 2.0
|
|
# (the "License"); you may not use this file except in compliance with
|
|
# the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# This is sourced in by bin/sqoop to set environment variables prior to
|
|
# invoking Hadoop.
|
|
|
|
bin="$1"
|
|
|
|
if [ -z "${bin}" ]; then
|
|
bin=`dirname $0`
|
|
bin=`cd ${bin} && pwd`
|
|
fi
|
|
|
|
if [ -z "$SQOOP_HOME" ]; then
|
|
export SQOOP_HOME=${bin}/..
|
|
fi
|
|
|
|
if [ -z "${HADOOP_HOME}" ]; then
|
|
# Try CDH default if the user hasn't set this.
|
|
HADOOP_HOME=/usr/lib/hadoop
|
|
fi
|
|
|
|
# Where to find the main Sqoop jar
|
|
SQOOP_JAR_DIR=$SQOOP_HOME
|
|
|
|
# Where to find the shim jars.
|
|
SQOOP_SHIM_DIR=$SQOOP_HOME/shims
|
|
|
|
# If there's a "build" subdir, override with this, so we use
|
|
# the newly-compiled copy.
|
|
if [ -d "$SQOOP_JAR_DIR/build" ]; then
|
|
SQOOP_JAR_DIR="${SQOOP_JAR_DIR}/build"
|
|
|
|
if [ -d "$SQOOP_JAR_DIR/shims" ]; then
|
|
SQOOP_SHIM_DIR="$SQOOP_JAR_DIR/shims"
|
|
fi
|
|
fi
|
|
|
|
# Add sqoop dependencies to classpath.
|
|
SQOOP_CLASSPATH=""
|
|
if [ -d "$SQOOP_HOME/lib" ]; then
|
|
for f in $SQOOP_HOME/lib/*.jar; do
|
|
SQOOP_CLASSPATH=${SQOOP_CLASSPATH}:$f;
|
|
done
|
|
fi
|
|
|
|
# If there's a build subdir, use Ivy-retrieved dependencies too.
|
|
if [ -d "$SQOOP_HOME/build/ivy/lib/sqoop" ]; then
|
|
for f in $SQOOP_HOME/build/ivy/lib/sqoop/*/*.jar; do
|
|
SQOOP_CLASSPATH=${SQOOP_CLASSPATH}:$f;
|
|
done
|
|
fi
|
|
|
|
export SQOOP_CLASSPATH
|
|
export SQOOP_JAR_DIR
|
|
export SQOOP_SHIM_DIR
|
|
export SQOOP_JAR=`ls -1 ${SQOOP_JAR_DIR}/sqoop-*.jar | head -n 1`
|
|
export HADOOP_CLASSPATH="${SQOOP_CLASSPATH}:${HADOOP_CLASSPATH}"
|
|
export HADOOP_HOME
|
|
export HADOOP_OPTS="-Dsqoop.shim.jar.dir=${SQOOP_SHIM_DIR} ${HADOOP_OPTS}"
|
|
|