diff --git a/build.xml b/build.xml index f1e29899..b843e0d2 100644 --- a/build.xml +++ b/build.xml @@ -312,10 +312,20 @@ the wrapper scripts to invoke each of these. --> + + + + + + diff --git a/src/scripts/create-tool-scripts.sh b/src/scripts/create-tool-scripts.sh index 3a175004..52c13a81 100755 --- a/src/scripts/create-tool-scripts.sh +++ b/src/scripts/create-tool-scripts.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Licensed to Cloudera, Inc. under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,15 +18,19 @@ # Arguments to this script: # The output directory for the result scripts # The path to the script template file. +# A file containing the list of tools, one per line. # This script should be run in the base directory of the project. # It will run 'bin/sqoop help' and determine the names of all subprograms, # and then generate wrapper scripts for each of these. +set -e + bin=`dirname $0` bin=`cd ${bin} && pwd` outdir=$1 template=$2 +toollistfile=$3 if [ -z "$outdir" ]; then echo "Output directory is required as the first argument." @@ -38,6 +42,11 @@ if [ -z "$template" ]; then exit 1 fi +if [ -z "$toollistfile" ]; then + echo "The list of tools is not specified" + exit 1 +fi + if [ ! -d "$outdir" ]; then echo "Output directory does not exist!" exit 1 @@ -48,8 +57,14 @@ if [ ! -f "$template" ]; then exit 1 fi +if [ ! -f "$toollistfile" ]; then + echo "Could not find tool list file: " $toollistfile + exit 1 +fi + # Query 'sqoop help' for the list of available commands. -subprograms=`bin/sqoop help | awk ' BEGIN {use=0} /^$/ {use=0} \ +# The output of 'sqoop help' has been written to $toollistfile. +subprograms=`cat $toollistfile | awk ' BEGIN {use=0} /^$/ {use=0} \ { if (use) { print $1 } else { } } /^Available/ {use=1} '` # For each of these, copy the template into place and sed the diff --git a/src/scripts/tool-script.sh.template b/src/scripts/tool-script.sh.template index 4de96f3d..2f4ec62c 100644 --- a/src/scripts/tool-script.sh.template +++ b/src/scripts/tool-script.sh.template @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Licensed to Cloudera, Inc. under one or more # contributor license agreements. See the NOTICE file distributed with