mirror of
https://github.com/apache/sqoop.git
synced 2025-05-02 23:40:04 +08:00
Add bin/sqoop script.
From: Aaron Kimball <aaron@cloudera.com> git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149886 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
799f7e9070
commit
0238221e7d
61
bin/sqoop
Executable file
61
bin/sqoop
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
prgm=`readlink -f $0`
|
||||||
|
bin=`dirname ${prgm}`
|
||||||
|
bin=`cd ${bin} && pwd`
|
||||||
|
|
||||||
|
if [ -z "$SQOOP_HOME" ]; then
|
||||||
|
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
|
||||||
|
|
||||||
|
SQOOP_JAR=`ls -1 ${SQOOP_JAR_DIR}/sqoop-*.jar | head -n 1`
|
||||||
|
|
||||||
|
# Invoke Hadoop
|
||||||
|
HADOOP_CLASSPATH="${SQOOP_CLASSPATH}:${HADOOP_CLASSPATH}" \
|
||||||
|
HADOOP_OPTS="-Dsqoop.shim.jar.dir=${SQOOP_SHIM_DIR}" \
|
||||||
|
${HADOOP_HOME}/bin/hadoop jar ${SQOOP_JAR} org.apache.hadoop.sqoop.Sqoop "$@"
|
||||||
|
|
11
build.xml
11
build.xml
@ -224,7 +224,8 @@
|
|||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- copy in all shim artifacts -->
|
<!-- copy in all shim artifacts -->
|
||||||
<copy todir="${dist.dir}" includeEmptyDirs="false" flatten="true">
|
<mkdir dir="${dist.dir}/shims" />
|
||||||
|
<copy todir="${dist.dir}/shims" includeEmptyDirs="false" flatten="true">
|
||||||
<fileset dir="${build.shim.dir}">
|
<fileset dir="${build.shim.dir}">
|
||||||
<include name="*.jar" />
|
<include name="*.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
@ -266,13 +267,21 @@
|
|||||||
<include name="**/*" />
|
<include name="**/*" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
|
<chmod perm="ugo+x" type="file" parallel="false">
|
||||||
|
<fileset dir="${dist.dir}/bin" />
|
||||||
|
</chmod>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="tar" depends="package" description="Create release tarball">
|
<target name="tar" depends="package" description="Create release tarball">
|
||||||
<tar compression="gzip" longfile="gnu" destfile="${tar.file}">
|
<tar compression="gzip" longfile="gnu" destfile="${tar.file}">
|
||||||
<tarfileset dir="${build.dir}" mode="664">
|
<tarfileset dir="${build.dir}" mode="664">
|
||||||
|
<exclude name="${artifact.name}/bin/*" />
|
||||||
<include name="${artifact.name}/**" />
|
<include name="${artifact.name}/**" />
|
||||||
</tarfileset>
|
</tarfileset>
|
||||||
|
<tarfileset dir="${build.dir}" mode="755">
|
||||||
|
<include name="${artifact.name}/bin/*" />
|
||||||
|
</tarfileset>
|
||||||
</tar>
|
</tar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user