From 5d0c8f82b87e7cbb541ace9e4f22abfad2799e56 Mon Sep 17 00:00:00 2001
From: Aaron Kimball <aaron@cloudera.com>
Date: Fri, 12 Mar 2010 17:35:08 -0800
Subject: [PATCH] CLOUDERA-BUILD. Sqoop bin script now includes jars from contrib/sqoop/lib/ on classpath.

Author: Aaron Kimball
---
 bin/sqoop |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bin/sqoop b/bin/sqoop
index 63bcd58..df7cb49 100755
--- a/bin/sqoop
+++ b/bin/sqoop
@@ -6,6 +6,14 @@ bin=`cd ${bin} && pwd`
 . "$bin"/hadoop-config.sh
 SQOOP_JAR_PATH="$HADOOP_HOME/contrib/sqoop"
 
-SQOOP_JAR=`ls -1 ${SQOOP_JAR_PATH}/hadoop-*-sqoop.jar | head -n 1`
-${bin}/hadoop jar ${SQOOP_JAR} org.apache.hadoop.sqoop.Sqoop "$@"
+# Add sqoop dependencies to classpath.
+SQOOP_CLASSPATH=""
+if [ -d "$SQOOP_JAR_PATH/lib" ]; then
+  for f in $SQOOP_JAR_PATH/lib/*.jar; do
+    SQOOP_CLASSPATH=${SQOOP_CLASSPATH}:$f;
+  done
+fi
 
+SQOOP_JAR=`ls -1 ${SQOOP_JAR_PATH}/hadoop-*-sqoop.jar | head -n 1`
+HADOOP_CLASSPATH="${SQOOP_CLASSPATH}:${HADOOP_CLASSPATH}" \
+    ${bin}/hadoop jar ${SQOOP_JAR} org.apache.hadoop.sqoop.Sqoop "$@"
-- 
1.6.0.4

