BIGTOP-1465. Allow both Sqoop 1.x and Sqoop 1.99.x / Sqoop 2.x to be distributed
Signed-off-by: Evans Ye <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/a241ffb3 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/a241ffb3 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/a241ffb3 Branch: refs/heads/master Commit: a241ffb3e5c52ea8e41fbd07af539cd62c478cbf Parents: defa038 Author: Sean Mackrory <[email protected]> Authored: Fri Feb 6 11:41:52 2015 -0700 Committer: Evans Ye <[email protected]> Committed: Thu Mar 5 01:47:28 2015 +0000 ---------------------------------------------------------------------- .../src/common/sqoop/catalina.properties | 80 -------- .../src/common/sqoop/do-component-build | 16 +- .../src/common/sqoop/install_sqoop.sh | 107 +++++----- .../src/common/sqoop/sqoop-metastore.sh | 178 +++++++++++++++++ .../src/common/sqoop/sqoop-metastore.sh.suse | 145 ++++++++++++++ .../src/common/sqoop/sqoop-server.sh | 35 ---- .../src/common/sqoop/sqoop-server.svc | 106 ---------- bigtop-packages/src/common/sqoop/sqoop-tool.sh | 36 ---- bigtop-packages/src/common/sqoop/sqoop.default | 26 --- bigtop-packages/src/common/sqoop/sqoop.sh | 27 --- .../src/common/sqoop/tomcat-deployment.sh | 40 ---- .../src/common/sqoop2/catalina.properties | 81 ++++++++ .../src/common/sqoop2/do-component-build | 46 +++++ .../src/common/sqoop2/install_sqoop2.sh | 181 +++++++++++++++++ .../src/common/sqoop2/sqoop-server.sh | 35 ++++ .../src/common/sqoop2/sqoop-server.svc | 112 +++++++++++ bigtop-packages/src/common/sqoop2/sqoop-tool.sh | 36 ++++ bigtop-packages/src/common/sqoop2/sqoop.sh | 27 +++ .../src/common/sqoop2/sqoop2.default | 27 +++ .../src/common/sqoop2/tomcat-deployment.sh | 59 ++++++ bigtop-packages/src/deb/sqoop/changelog | 2 +- bigtop-packages/src/deb/sqoop/compat | 1 - bigtop-packages/src/deb/sqoop/control | 20 +- bigtop-packages/src/deb/sqoop/copyright | 8 +- bigtop-packages/src/deb/sqoop/rules | 23 +-- .../src/deb/sqoop/sqoop-client.install | 7 - .../src/deb/sqoop/sqoop-metastore.postinst | 35 ++++ .../src/deb/sqoop/sqoop-server.install | 1 - .../src/deb/sqoop/sqoop-server.postinst | 21 -- bigtop-packages/src/deb/sqoop/sqoop.install | 10 - bigtop-packages/src/deb/sqoop/sqoop.postinst | 22 +- bigtop-packages/src/deb/sqoop/sqoop.preinst | 14 +- bigtop-packages/src/deb/sqoop/sqoop.prerm | 15 +- bigtop-packages/src/deb/sqoop2/changelog | 1 + bigtop-packages/src/deb/sqoop2/compat | 2 + bigtop-packages/src/deb/sqoop2/control | 39 ++++ bigtop-packages/src/deb/sqoop2/copyright | 11 + bigtop-packages/src/deb/sqoop2/rules | 44 ++++ bigtop-packages/src/deb/sqoop2/source/format | 1 + .../src/deb/sqoop2/sqoop2-client.install | 6 + .../src/deb/sqoop2/sqoop2-server.install | 1 + .../src/deb/sqoop2/sqoop2-server.postinst | 21 ++ bigtop-packages/src/deb/sqoop2/sqoop2.install | 11 + bigtop-packages/src/deb/sqoop2/sqoop2.postinst | 21 ++ bigtop-packages/src/deb/sqoop2/sqoop2.preinst | 65 ++++++ bigtop-packages/src/deb/sqoop2/sqoop2.prerm | 46 +++++ bigtop-packages/src/rpm/sqoop/SPECS/sqoop.spec | 181 ++++++++--------- bigtop-packages/src/rpm/sqoop2/BUILD/.gitignore | 2 + bigtop-packages/src/rpm/sqoop2/RPMS/.gitignore | 0 .../src/rpm/sqoop2/SOURCES/.gitignore | 0 .../src/rpm/sqoop2/SPECS/sqoop2.spec | 200 +++++++++++++++++++ bigtop-packages/src/rpm/sqoop2/SRPMS/.gitignore | 0 bigtop.mk | 16 +- pom.xml | 3 +- 54 files changed, 1651 insertions(+), 599 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/catalina.properties ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/catalina.properties b/bigtop-packages/src/common/sqoop/catalina.properties deleted file mode 100644 index 9db1e56..0000000 --- a/bigtop-packages/src/common/sqoop/catalina.properties +++ /dev/null @@ -1,80 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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. - -# -# List of comma-separated packages that start with or equal this string -# will cause a security exception to be thrown when -# passed to checkPackageAccess unless the -# corresponding RuntimePermission ("accessClassInPackage."+package) has -# been granted. -package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans. -# -# List of comma-separated packages that start with or equal this string -# will cause a security exception to be thrown when -# passed to checkPackageDefinition unless the -# corresponding RuntimePermission ("defineClassInPackage."+package) has -# been granted. -# -# by default, no packages are restricted for definition, and none of -# the class loaders supplied with the JDK call checkPackageDefinition. -# -package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper. - -# -# -# List of comma-separated paths defining the contents of the "common" -# classloader. Prefixes should be used to define what is the repository type. -# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. -# If left as blank,the JVM system loader will be used as Catalina's "common" -# loader. -# Examples: -# "foo": Add this folder as a class repository -# "foo/*.jar": Add all the JARs of the specified folder as class -# repositories -# "foo/bar.jar": Add bar.jar as a class repository -common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/sqoop/*.jar,/usr/lib/hadoop/client/*.jar -# -# List of comma-separated paths defining the contents of the "server" -# classloader. Prefixes should be used to define what is the repository type. -# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. -# If left as blank, the "common" loader will be used as Catalina's "server" -# loader. -# Examples: -# "foo": Add this folder as a class repository -# "foo/*.jar": Add all the JARs of the specified folder as class -# repositories -# "foo/bar.jar": Add bar.jar as a class repository -server.loader= - -# -# List of comma-separated paths defining the contents of the "shared" -# classloader. Prefixes should be used to define what is the repository type. -# Path may be relative to the CATALINA_BASE path or absolute. If left as blank, -# the "common" loader will be used as Catalina's "shared" loader. -# Examples: -# "foo": Add this folder as a class repository -# "foo/*.jar": Add all the JARs of the specified folder as class -# repositories -# "foo/bar.jar": Add bar.jar as a class repository -# Please note that for single jars, e.g. bar.jar, you need the URL form -# starting with file:. -shared.loader= - -# -# String cache configuration. -tomcat.util.buf.StringCache.byte.enabled=true -#tomcat.util.buf.StringCache.char.enabled=true -#tomcat.util.buf.StringCache.trainThreshold=500000 -#tomcat.util.buf.StringCache.cacheSize=5000 http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/do-component-build ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/do-component-build b/bigtop-packages/src/common/sqoop/do-component-build old mode 100644 new mode 100755 index 36370d6..77be764 --- a/bigtop-packages/src/common/sqoop/do-component-build +++ b/bigtop-packages/src/common/sqoop/do-component-build @@ -15,19 +15,11 @@ # limitations under the License. set -ex - . `dirname ${0}`/bigtop.bom -export MAVEN_OPTS='-Xmx512m -XX:MaxPermSize=512m' -mvn -DskipTests=true -Dhadoop.profile=200 -Dhadoop.2.version=$HADOOP_VERSION install package -P=binary $@ - -cd dist/target -for file in `find ./ -name 'sqoop-*-bin-hadoop*' -type d`; do - mv $file sqoop-$SQOOP_VERSION -done -tar czf sqoop-$SQOOP_VERSION.tar.gz sqoop-$SQOOP_VERSION -cd ../.. +# Use of StringUtils.repeat in src/test/org/apache/sqoop/TestExportUsingProcedure +# is incompatible with Apache Commons Lang 2.4 +sed -i -e 's/sql.append(StringUtils.repeat("?", ", ",/sql.append(StringUtils.repeat("?",/' src/test/org/apache/sqoop/TestExportUsingProcedure.java -mkdir build -mv dist/target/sqoop-$SQOOP_VERSION.tar.gz build/ +ant -f build.xml -Dhadoopversion=210 -Dhadoop.version.full=$HADOOP_VERSION -Dhadoop.version=$HADOOP_VERSION -Dhbase.version=$HBASE_VERSION -Dzookeeper.version=$ZOOKEEPER_VERSION package jar "$@" http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/install_sqoop.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/install_sqoop.sh b/bigtop-packages/src/common/sqoop/install_sqoop.sh index 5d42a2c..32cf4ba 100755 --- a/bigtop-packages/src/common/sqoop/install_sqoop.sh +++ b/bigtop-packages/src/common/sqoop/install_sqoop.sh @@ -32,7 +32,6 @@ usage: $0 <options> --bin-dir=DIR path to install bins [/usr/bin] --conf-dir=DIR path to configuration files provided by the package [/etc/sqoop/conf.dist] --examples-dir=DIR path to install examples [doc-dir/examples] - --initd-dir=DIR path to install init scripts [/etc/init.d] ... [ see source for more similar options ] " exit 1 @@ -48,10 +47,8 @@ OPTS=$(getopt \ -l 'installed-lib-dir:' \ -l 'bin-dir:' \ -l 'examples-dir:' \ - -l 'build-dir:' \ -l 'extra-dir:' \ - -l 'initd-dir:' \ - -l 'dist-dir:' -- "$@") + -l 'build-dir:' -- "$@") if [ $? != 0 ] ; then usage @@ -88,12 +85,6 @@ while true ; do --extra-dir) EXTRA_DIR=$2 ; shift 2 ;; - --initd-dir) - INITD_DIR=$2 ; shift 2 - ;; - --dist-dir) - DIST_DIR=$2 ; shift 2 - ;; --) shift ; break ;; @@ -118,63 +109,61 @@ BIN_DIR=${BIN_DIR:-/usr/lib/sqoop/bin} ETC_DIR=${ETC_DIR:-/etc/sqoop} MAN_DIR=${MAN_DIR:-/usr/share/man/man1} CONF_DIR=${CONF_DIR:-${ETC_DIR}/conf.dist} -INITD_DIR=${INITD_DIR:-/etc/init.d} -DIST_DIR=${DIST_DIR:-dist/target/sqoop-*} -TOMCAT_CONF_DIR=${ETC_DIR}/tomcat-conf install -d -m 0755 ${PREFIX}/${LIB_DIR} -install -d -m 0755 ${PREFIX}/${LIB_DIR}/client-lib -install -d -m 0755 ${PREFIX}/${BIN_DIR} -install -d -m 0755 ${PREFIX}/${CONF_DIR} -install -d -m 0755 ${PREFIX}/etc/default -install -d -m 0755 ${PREFIX}/var/lib/sqoop -install -m 0644 ${DIST_DIR}/shell/lib/*.jar ${PREFIX}/${LIB_DIR}/client-lib/ -install -m 0755 ${DIST_DIR}/bin/sqoop.sh ${PREFIX}/${BIN_DIR}/ -install -m 0755 ${DIST_DIR}/bin/sqoop-sys.sh ${PREFIX}/${BIN_DIR}/ +install -d -m 0755 ${PREFIX}/${LIB_DIR} +cp ${BUILD_DIR}/sqoop*.jar ${PREFIX}/${LIB_DIR} + +install -d -m 0755 ${PREFIX}/${LIB_DIR}/lib +cp -a ${BUILD_DIR}/lib/*.jar ${PREFIX}/${LIB_DIR}/lib + +#install -d -m 0755 ${PREFIX}/${LIB_DIR}/shims +#cp -a shims/*.jar ${PREFIX}/${LIB_DIR}/shims -install -m 0644 ${DIST_DIR}/server/conf/sqoop.properties ${PREFIX}/${CONF_DIR}/sqoop.properties -sed -i 's#@LOGDIR@#/var/log/sqoop#' ${PREFIX}/${CONF_DIR}/sqoop.properties -sed -i 's#@BASEDIR@#/var/lib/sqoop#' ${PREFIX}/${CONF_DIR}/sqoop.properties +install -d -m 0755 $PREFIX/usr/bin -install -m 0644 ${DIST_DIR}/server/conf/sqoop_bootstrap.properties ${PREFIX}/${CONF_DIR} -install -m 0644 ${EXTRA_DIR}/sqoop.default ${PREFIX}/etc/default/sqoop-server -rm ${EXTRA_DIR}/sqoop.default # Otherwise debhelper will re-install this +install -d -m 0755 $PREFIX/${BIN_DIR} +cp ${BUILD_DIR}/bin/* $PREFIX/${BIN_DIR} -install -m 0755 ${DIST_DIR}/server/bin/setenv.sh ${PREFIX}/${CONF_DIR}/ -sed -i -e 's#-Dsqoop.config.dir=.*conf#-Dsqoop.config.dir=/etc/sqoop/conf#' ${PREFIX}/${CONF_DIR}/setenv.sh -ln -s ${CONF_DIR}/setenv.sh ${PREFIX}/${BIN_DIR}/ +install -d -m 0755 $PREFIX/${DOC_DIR} +cp ${BUILD_DIR}/docs/*.html $PREFIX/${DOC_DIR} +cp ${BUILD_DIR}/docs/*.css $PREFIX/${DOC_DIR} +cp -r ${BUILD_DIR}/docs/api $PREFIX/${DOC_DIR} +cp -r ${BUILD_DIR}/docs/images $PREFIX/${DOC_DIR} -# Explode the WAR -SQOOP_WEBAPPS=${PREFIX}/${LIB_DIR}/webapps -cp -r ${DIST_DIR}/server/webapps $SQOOP_WEBAPPS -unzip -d $SQOOP_WEBAPPS/sqoop $SQOOP_WEBAPPS/sqoop.war -install -m 0755 ${EXTRA_DIR}/tomcat-deployment.sh ${PREFIX}/${LIB_DIR}/tomcat-deployment.sh +install -d -m 0755 $PREFIX/$MAN_DIR +for i in sqoop sqoop-codegen sqoop-export sqoop-import-all-tables sqoop-version sqoop-create-hive-table sqoop-help sqoop-list-databases sqoop-eval sqoop-import sqoop-list-tables sqoop-job sqoop-metastore sqoop-merge + do echo "Copying manpage $i" + cp ${BUILD_DIR}/docs/man/$i* $PREFIX/$MAN_DIR + echo "Creating wrapper for $i" + wrapper=$PREFIX/usr/bin/$i + mkdir -p `dirname $wrapper` + cat > $wrapper <<EOF +#!/bin/bash + +# Autodetect JAVA_HOME if not defined +. /usr/lib/bigtop-utils/bigtop-detect-javahome -install -d -m 0755 ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf -for conf in web.xml tomcat-users.xml server.xml logging.properties context.xml catalina.policy -do - install -m 0644 ${DIST_DIR}/server/conf/$conf ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/ +SQOOP_JARS=\`ls /var/lib/sqoop/*.jar /usr/share/java/*.jar 2>/dev/null\` +if [ -n "\${SQOOP_JARS}" ]; then + export HADOOP_CLASSPATH=\$(JARS=(\${SQOOP_JARS}); IFS=:; echo "\${HADOOP_CLASSPATH}:\${JARS[*]}") +fi + +export SQOOP_HOME=$LIB_DIR +exec $BIN_DIR/$i "\$@" +EOF + chmod 0755 $wrapper done -sed -i -e "s|<Host |<Host workDir=\"/var/tmp/sqoop\" |" ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/server.xml -sed -i -e "s|\${catalina\.base}/logs|/var/log/sqoop|" ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/logging.properties -cp -f ${EXTRA_DIR}/catalina.properties ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/catalina.properties -install -d -m 0755 ${PREFIX}/${TOMCAT_CONF_DIR}.dist/WEB-INF -mv $SQOOP_WEBAPPS/sqoop/WEB-INF/*.xml ${PREFIX}/${TOMCAT_CONF_DIR}.dist/WEB-INF - -# Create wrapper scripts for the client and server -client_wrapper=$PREFIX/usr/bin/sqoop -server_wrapper=$PREFIX/usr/bin/sqoop-server -tool_wrapper=$PREFIX/usr/bin/sqoop-tool -mkdir -p $PREFIX/usr/bin -install -m 0755 $EXTRA_DIR/sqoop.sh $client_wrapper -install -m 0755 $EXTRA_DIR/sqoop-server.sh $server_wrapper -install -m 0755 $EXTRA_DIR/sqoop-tool.sh $tool_wrapper - -CATALINA_HOME=/usr/lib/bigtop-tomcat -install -d ${PREFIX}/${CATALINA_HOME}/lib -install -m 0644 ${DIST_DIR}/server/lib/sqoop-tomcat*.jar ${PREFIX}/${CATALINA_HOME}/lib/ - -cp ${DIST_DIR}/{LICENSE,NOTICE}.txt ${PREFIX}/${LIB_DIR}/ + +install -d -m 0755 $PREFIX/$CONF_DIR +(cd ${BUILD_DIR}/conf && tar cf - .) | (cd $PREFIX/$CONF_DIR && tar xf -) + +unlink $PREFIX/$LIB_DIR/conf || /bin/true +ln -s $ETC_DIR/conf $PREFIX/$LIB_DIR/conf + +install -d -m 0755 ${PREFIX}/var/lib/sqoop + +cp ${BUILD_DIR}/{LICENSE,NOTICE}.txt ${PREFIX}/${LIB_DIR}/ http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/sqoop-metastore.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/sqoop-metastore.sh b/bigtop-packages/src/common/sqoop/sqoop-metastore.sh new file mode 100644 index 0000000..e580ee3 --- /dev/null +++ b/bigtop-packages/src/common/sqoop/sqoop-metastore.sh @@ -0,0 +1,178 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +# chkconfig: 2345 90 10 +# description: Sqoop allows easy imports and exports of data sets between \ +# databases and the Hadoop Distributed File System (HDFS). The Sqoop \ +# metastore allows users to define saved jobs for repeated execution and \ +# share them with other users of the cluster. +# processname: java +# pidfile: /var/run/sqoop/sqoop-metastore.pid +### BEGIN INIT INFO +# Provides: Sqoop +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $remote_fs +# Should-Start: $named +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Sqoop allows easy imports and exports of data sets between databases and the Hadoop Distributed File System (HDFS). +### END INIT INFO +set -e + +# Autodetect JAVA_HOME if not defined +. /usr/lib/bigtop-utils/bigtop-detect-javahome + +BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default} +[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hadoop ] && . ${BIGTOP_DEFAULTS_DIR}/hadoop + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +NAME=sqoop-metastore +DESC="Sqoop metastore" +PID_FILE=/var/run/sqoop/sqoop-metastore.pid +LOGDIR=/var/log/sqoop + +DODTIME=3 + +# Returns 0 if pid is alive, 1 if not. +hadoop_is_process_alive() { + local pid="$1" + ps -fp $pid | grep $pid | grep sqoop > /dev/null 2>&1 +} + +hadoop_check_pidfile() { + local pidfile="$1" # IN + local pid + + pid=`cat "$pidfile" 2>/dev/null` + if [ "$pid" = '' ]; then + # The file probably does not exist or is empty. + return 1 + fi + + set -- $pid + pid="$1" + + hadoop_is_process_alive $pid +} + +hadoop_process_kill() { + local pid="$1" # IN + local signal="$2" # IN + local second + + kill -$signal $pid 2>/dev/null + + # Wait a bit to see if the dirty job has really been done + for second in {0..10}; do + if hadoop_is_process_alive "$pid"; then + # Success + return 0 + fi + + sleep 1 + done + + # Timeout + return 1 +} +hadoop_stop_pidfile() { + local pidfile="$1" # IN + local pid + + pid=`cat "$pidfile" 2>/dev/null` + if [ "$pid" = '' ]; then + # The file probably does not exist or is empty. Success + return 0 + fi + + set -- $pid + pid="$1" + + # First try the easy way + if hadoop_process_kill "$pid" 15; then + return 0 + fi + + # Otherwise try the hard way + if hadoop_process_kill "$pid" 9; then + return 0 + fi + + return 1 +} + + +start() { + # Pid files created in sqoop-specific directory under /var/run. + # The dir should be recreated first. + local piddir=`dirname "$PID_FILE"` + install -d -m 0755 -o sqoop -g sqoop "$piddir" + su -s /bin/bash sqoop -c \ + "/usr/lib/sqoop/bin/start-metastore.sh -p $PID_FILE -l $LOGDIR" +} +stop() { + su -s /bin/bash sqoop -c \ + "/usr/lib/sqoop/bin/stop-metastore.sh -p $PID_FILE" +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + force-stop) + echo -n "Forcefully stopping $DESC: " + hadoop_stop_pidfile $PID_FILE + if ! hadoop_check_pidfile $PID_FILE ; then + echo "$NAME." + else + echo "ERROR." + fi + rm $PID_FILE + ;; + force-reload|condrestart|try-restart) + # check whether $DAEMON is running. If so, restart + hadoop_check_pidfile $PID_FILE && $0 restart + ;; + restart|reload) + echo -n "Restarting $DESC: " + stop + [ -n "$DODTIME" ] && sleep $DODTIME + $0 start + ;; + status) + echo -n "$NAME is " + if hadoop_check_pidfile $PID_FILE ; then + echo "running" + else + echo "not running." + exit 1 + fi + ;; + + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload|status|force-stop|condrestart|try-restart}" >&2 + exit 1 + ;; +esac + +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/sqoop-metastore.sh.suse ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/sqoop-metastore.sh.suse b/bigtop-packages/src/common/sqoop/sqoop-metastore.sh.suse new file mode 100644 index 0000000..82b05df --- /dev/null +++ b/bigtop-packages/src/common/sqoop/sqoop-metastore.sh.suse @@ -0,0 +1,145 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +# Starts a Sqoop metastore +# +# chkconfig: 2345 90 10 +# description: Sqoop allows easy imports and exports of data sets between \ +# databases and the Hadoop Distributed File System (HDFS). The Sqoop \ +# metastore allows users to define saved jobs for repeated execution and \ +# share them with other users of the cluster. +# processname: java +# +### BEGIN INIT INFO +# Provides: Sqoop +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $remote_fs +# Should-Start: $named +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Sqoop allows easy imports and exports of data sets between databases and the Hadoop Distributed File System (HDFS). +### END INIT INFO + +. /lib/lsb/init-functions + +# Autodetect JAVA_HOME if not defined +. /usr/lib/bigtop-utils/bigtop-detect-javahome + +BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default} +[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hadoop ] && . ${BIGTOP_DEFAULTS_DIR}/hadoop + +STATUS_RUNNING=0 +STATUS_DEAD=1 +STATUS_DEAD_AND_LOCK=2 +STATUS_NOT_RUNNING=3 + +ERROR_PROGRAM_NOT_INSTALLED=5 +ERROR_PROGRAM_NOT_CONFIGURED=6 + + +RETVAL=0 +NAME=sqoop-metastore +DESC="Sqoop metastore" +PID_FILE=/var/run/sqoop/sqoop-metastore.pid +LOCKFILE="/var/lock/subsys/sqoop-metastore" +LOGDIR=/var/log/sqoop +SQOOP_BIN_PATH="/usr/lib/sqoop/bin" +USER="sqoop" +GROUP="sqoop" + +start() { + [ -x ${SQOOP_BIN_PATH}/start-metastore.sh ] || exit $ERROR_PROGRAM_NOT_INSTALLED + + # Pid files created in sqoop-specific directory under /var/run. + # The dir should be recreated first. + local piddir=`dirname "$PID_FILE"` + install -d -m 0755 -o $USER -g $GROUP "$piddir" + + log_success_msg "Starting $DESC: " + start_daemon -u $USER ${SQOOP_BIN_PATH}/start-metastore.sh -p $PID_FILE -l $LOGDIR + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $LOCKFILE + return $RETVAL +} + +stop() { + [ -x ${SQOOP_BIN_PATH}/stop-metastore.sh ] || exit $ERROR_PROGRAM_NOT_INSTALLED + log_success_msg "Stopping $DESC: " + start_daemon -u $USER ${SQOOP_BIN_PATH}/stop-metastore.sh -p $PID_FILE + RETVAL=$? + sleep 5 + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE $PIDFILE +} + +restart() { + stop + start +} + +checkstatus(){ + pidofproc -p $PID_FILE java > /dev/null + status=$? + + case "$status" in + $STATUS_RUNNING) + log_success_msg "$DESC is running" + ;; + $STATUS_DEAD) + log_failure_msg "$DESC is dead and pid file exists" + ;; + $STATUS_DEAD_AND_LOCK) + log_failure_msg "$DESC is dead and lock file exists" + ;; + $STATUS_NOT_RUNNING) + log_failure_msg "$DESC is not running" + ;; + *) + log_failure_msg "$DESC status is unknown" + ;; + esac + return $status +} + +condrestart(){ + [ -e $LOCKFILE ] && restart || : +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + checkstatus + ;; + restart) + restart + ;; + condrestart|try-restart) + condrestart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|try-restart|condrestart}" + exit 1 +esac + +exit $RETVAL http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/sqoop-server.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/sqoop-server.sh b/bigtop-packages/src/common/sqoop/sqoop-server.sh deleted file mode 100644 index a332ce8..0000000 --- a/bigtop-packages/src/common/sqoop/sqoop-server.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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. - -# Autodetect JAVA_HOME if not defined -. /usr/lib/bigtop-utils/bigtop-detect-javahome -. /usr/lib/bigtop-utils/bigtop-detect-classpath - -LIB_DIR=${LIB_DIR:-/usr/lib} - -SQOOP_HOME=${LIB_DIR}/sqoop -TOMCAT_HOME=${LIB_DIR}/bigtop-tomcat - -. /usr/lib/sqoop/tomcat-deployment.sh - -export CATALINA_BIN=${CATALINA_BIN:-${TOMCAT_HOME}/bin} -export CATALINA_BASE=${CATALINA_BASE:-${DEPLOYMENT_TARGET}} -export CATALINA_OPTS=${CATALINA_OPTS:--Xmx1024m} -export CATALINA_OUT=${CATALINE_OUT:-/var/log/sqoop/sqoop-tomcat.log} - -env CLASSPATH=$CLASSPATH $SQOOP_HOME/bin/sqoop.sh server $@ - http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/sqoop-server.svc ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/sqoop-server.svc b/bigtop-packages/src/common/sqoop/sqoop-server.svc deleted file mode 100644 index 26be910..0000000 --- a/bigtop-packages/src/common/sqoop/sqoop-server.svc +++ /dev/null @@ -1,106 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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. - -DAEMON="sqoop-server" -DESC="Sqoop Server" -EXEC_PATH="/usr/bin/sqoop-server" -SVC_USER="${SQOOP_USER:-sqoop}" -WORKING_DIR="/var/run/sqoop" -DAEMON_FLAGS="" -CONF_DIR="${SQOOP_CONFIG:-/etc/sqoop/conf}" -PIDFILE="${SQOOP_PID:-/var/run/sqoop/sqoop-server-$SVC_USER.pid}" - -generate_functions() { - -cat <<'__EOT__' -sqoop_env() { - export SQOOP_CONFIG - export CATALINA_BASE - export CATALINA_BIN - export CATALINA_PID=$SQOOP_PID - export CATALINA_OPTS - export CATALINA_OUT - export CATALINA_TMPDIR -} -__EOT__ - -} - -generate_start() { - -cat <<'__EOT__' -start() { - [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED - [ -d $CONF_DIR ] || exit $ERROR_PROGRAM_NOT_CONFIGURED - log_success_msg "Starting ${DESC}: " - - sqoop_env - - su -s /bin/bash -c "cd ~/ && ${EXEC_PATH} start $DAEMON_FLAGS" $SVC_USER - - for second in {5..0} - do - checkstatusofproc - RETVAL=$? - if [ "$RETVAL" -eq $RETVAL_SUCCESS ] ; then - break - fi - sleep 1 - done - - [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE - return $RETVAL -} -__EOT__ - -} - -generate_stop() { - -cat <<'__EOT__' -stop() { - log_success_msg "Stopping ${DESC}: " - # FIXME: workaround for BIGTOP-537 - checkstatusofproc - if [ "$?" = "$STATUS_RUNNING" ] ; then - - sqoop_env - - su -s /bin/bash -c "cd ~/ && ${EXEC_PATH} stop" $SVC_USER - - SQOOP_SHUTDOWN_TIMEOUT=${SQOOP_SHUTDOWN_TIMEOUT:-60} - - if [ -f $PIDFILE ]; then - PID=`cat $PIDFILE` - if [ -n $PID ]; then - kill -TERM $PID &>/dev/null - for i in `seq 1 ${SQOOP_SHUTDOWN_TIMEOUT}` ; do - kill -0 ${SQOOP_PID} &>/dev/null || break - sleep 1 - done - kill -KILL ${SQOOP_PID} &>/dev/null - fi - fi - - RETVAL=$? - else - RETVAL=$RETVAL_SUCCESS - fi - - [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE -} -__EOT__ - -} http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/sqoop-tool.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/sqoop-tool.sh b/bigtop-packages/src/common/sqoop/sqoop-tool.sh deleted file mode 100644 index c008665..0000000 --- a/bigtop-packages/src/common/sqoop/sqoop-tool.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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. - -# Autodetect JAVA_HOME if not defined - -. /usr/lib/bigtop-utils/bigtop-detect-javahome - -export TOMCAT_DEPLOYMENT=/var/lib/sqoop/tool-tomcat-deployment -. /usr/lib/sqoop/tomcat-deployment.sh - -LIB_DIR=/usr/lib/sqoop -BIN_DIR=${LIB_DIR}/bin - -export CLASSPATH=$CLASSPATH:$(echo "$LIB_DIR"/client-lib/*.jar | tr ' ' ':') -export CATALINA_HOME=/usr/lib/bigtop-tomcat -export CATALINA_BIN=${CATALINA_HOME}/bin -export CATALINA_BASE=/var/lib/sqoop/tool-tomcat-deployment -export JAVA_OPTS="$JAVA_OPTS -Dsqoop.config.dir=/etc/sqoop/conf" - -COMMAND="cd ~/ && ${BIN_DIR}/sqoop.sh tool $@" -su -s /bin/bash -c "${COMMAND}" sqoop - http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/sqoop.default ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/sqoop.default b/bigtop-packages/src/common/sqoop/sqoop.default deleted file mode 100644 index e05da14..0000000 --- a/bigtop-packages/src/common/sqoop/sqoop.default +++ /dev/null @@ -1,26 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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. - -CATALINA_BASE=/var/lib/sqoop/tomcat-deployment -SQOOP_USER=sqoop -SQOOP_CONFIG=/etc/sqoop/conf -SQOOP_LOG=/var/log/sqoop -SQOOP_TEMP=/var/run/sqoop -SQOOP_PID=/var/run/sqoop/sqoop-server-sqoop.pid -CATALINA_BIN=/usr/lib/bigtop-tomcat/bin -CATALINA_TMPDIR=/var/tmp/sqoop -CATALINA_OPTS=-Xmx1024m -CATALINA_OUT=/var/log/sqoop/sqoop-tomcat.log -#AUX_CLASSPATH= http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/sqoop.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/sqoop.sh b/bigtop-packages/src/common/sqoop/sqoop.sh deleted file mode 100644 index f00947f..0000000 --- a/bigtop-packages/src/common/sqoop/sqoop.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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. - -# Autodetect JAVA_HOME if not defined -. /usr/lib/bigtop-utils/bigtop-detect-javahome - -LIB_DIR=/usr/lib/sqoop -BIN_DIR=${LIB_DIR}/bin - -CLASSPATH=$CLASSPATH:$(echo "$LIB_DIR"/client-lib/*.jar | tr ' ' ':') - -env CLASSPATH=$CLASSPATH $BIN_DIR/sqoop.sh client $@ - http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop/tomcat-deployment.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop/tomcat-deployment.sh b/bigtop-packages/src/common/sqoop/tomcat-deployment.sh deleted file mode 100644 index 19a907a..0000000 --- a/bigtop-packages/src/common/sqoop/tomcat-deployment.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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 script must be sourced so that it can set CATALINA_BASE for the parent process - -TOMCAT_CONF=${TOMCAT_CONF:-`readlink -e /etc/sqoop/tomcat-conf`} -TOMCAT_DEPLOYMENT=${TOMCAT_DEPLOYMENT:-/var/lib/sqoop/tomcat-deployment} -SQOOP_HOME=${SQOOP_HOME:-/usr/lib/sqoop} - -rm -rf ${TOMCAT_DEPLOYMENT} -mkdir ${TOMCAT_DEPLOYMENT} -cp -r ${TOMCAT_CONF}/conf ${TOMCAT_DEPLOYMENT} -cp -r ${SQOOP_HOME}/webapps ${TOMCAT_DEPLOYMENT}/webapps -cp -r ${TOMCAT_CONF}/WEB-INF/* ${TOMCAT_DEPLOYMENT}/webapps/sqoop/WEB-INF/ -cp -r ${SQOOP_HOME}/bin ${TOMCAT_DEPLOYMENT}/ - -export CATALINA_BASE=${TOMCAT_DEPLOYMENT} - -if [ -n "${BIGTOP_CLASSPATH}" ] ; then - sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${TOMCAT_DEPLOYMENT}/conf/catalina.properties -fi - -chown -R sqoop:sqoop ${TOMCAT_DEPLOYMENT} - -export CATALINA_BASE=${TOMCAT_DEPLOYMENT} - http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/catalina.properties ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/catalina.properties b/bigtop-packages/src/common/sqoop2/catalina.properties new file mode 100644 index 0000000..c947061 --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/catalina.properties @@ -0,0 +1,81 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageAccess unless the +# corresponding RuntimePermission ("accessClassInPackage."+package) has +# been granted. +package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans. +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageDefinition unless the +# corresponding RuntimePermission ("defineClassInPackage."+package) has +# been granted. +# +# by default, no packages are restricted for definition, and none of +# the class loaders supplied with the JDK call checkPackageDefinition. +# +package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper. + +# +# +# List of comma-separated paths defining the contents of the "common" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. +# If left as blank,the JVM system loader will be used as Catalina's "common" +# loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/sqoop2/*.jar,/usr/lib/hadoop/client/*.jar,/usr/share/java/*.jar + +# +# List of comma-separated paths defining the contents of the "server" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. +# If left as blank, the "common" loader will be used as Catalina's "server" +# loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +server.loader= + +# +# List of comma-separated paths defining the contents of the "shared" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_BASE path or absolute. If left as blank, +# the "common" loader will be used as Catalina's "shared" loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +# Please note that for single jars, e.g. bar.jar, you need the URL form +# starting with file:. +shared.loader= + +# +# String cache configuration. +tomcat.util.buf.StringCache.byte.enabled=true +#tomcat.util.buf.StringCache.char.enabled=true +#tomcat.util.buf.StringCache.trainThreshold=500000 +#tomcat.util.buf.StringCache.cacheSize=5000 http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/do-component-build ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/do-component-build b/bigtop-packages/src/common/sqoop2/do-component-build new file mode 100755 index 0000000..7dddfc0 --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/do-component-build @@ -0,0 +1,46 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +set -ex + +if [ -z "$GIT_REPO" ]; then + export MAVEN_OPTS='-Xmx512m -XX:MaxPermSize=512m' + if [ -z "${DO_MAVEN_DEPLOY}" ]; then + MAVEN_INST_DEPLOY=install + else + MAVEN_INST_DEPLOY=$DO_MAVEN_DEPLOY + fi + + mvn -DskipTests=true source:jar-no-fork javadoc:jar -P=binary $@ $MAVEN_INST_DEPLOY + +# Repackaging and changing the name to "sqoop2" is necessary as long +# as we continue to distribute a version of Sqoop 1.x as "sqoop" + cd dist/target + for file in `find ./ -name 'sqoop-*-bin-hadoop*' -type d`; do + mv $file sqoop2-$FULL_VERSION + done + tar czf sqoop2-$FULL_VERSION.tar.gz sqoop2-$FULL_VERSION + cd ../.. + + mkdir build + mv dist/target/sqoop2-$FULL_VERSION.tar.gz build/ +else + git add . + git commit -a -m "Temporary commit for tarball" + mkdir -p build + git archive --prefix=sqoop2-${FULL_VERSION}/ --format=tar HEAD | gzip > build/sqoop2-${FULL_VERSION}.tar.gz +fi + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/install_sqoop2.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/install_sqoop2.sh b/bigtop-packages/src/common/sqoop2/install_sqoop2.sh new file mode 100755 index 0000000..b875461 --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/install_sqoop2.sh @@ -0,0 +1,181 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +set -ex + +usage() { + echo " +usage: $0 <options> + Required not-so-options: + --build-dir=DIR path to sqoopdist.dir + --prefix=PREFIX path to install into + --extra-dir=DIR path to Bigtop distribution files + + Optional options: + --doc-dir=DIR path to install docs into [/usr/share/doc/sqoop2] + --lib-dir=DIR path to install sqoop home [/usr/lib/sqoop2] + --installed-lib-dir=DIR path where lib-dir will end up on target system + --bin-dir=DIR path to install bins [/usr/bin] + --conf-dir=DIR path to configuration files provided by the package [/etc/sqoop2/conf.dist] + --examples-dir=DIR path to install examples [doc-dir/examples] + --initd-dir=DIR path to install init scripts [/etc/init.d] + ... [ see source for more similar options ] + " + exit 1 +} + +OPTS=$(getopt \ + -n $0 \ + -o '' \ + -l 'prefix:' \ + -l 'doc-dir:' \ + -l 'lib-dir:' \ + -l 'conf-dir:' \ + -l 'installed-lib-dir:' \ + -l 'bin-dir:' \ + -l 'examples-dir:' \ + -l 'build-dir:' \ + -l 'extra-dir:' \ + -l 'initd-dir:' \ + -l 'dist-dir:' -- "$@") + +if [ $? != 0 ] ; then + usage +fi + +eval set -- "$OPTS" +set -ex +while true ; do + case "$1" in + --prefix) + PREFIX=$2 ; shift 2 + ;; + --build-dir) + BUILD_DIR=$2 ; shift 2 + ;; + --doc-dir) + DOC_DIR=$2 ; shift 2 + ;; + --lib-dir) + LIB_DIR=$2 ; shift 2 + ;; + --conf-dir) + CONF_DIR=$2 ; shift 2 + ;; + --installed-lib-dir) + INSTALLED_LIB_DIR=$2 ; shift 2 + ;; + --bin-dir) + BIN_DIR=$2 ; shift 2 + ;; + --examples-dir) + EXAMPLES_DIR=$2 ; shift 2 + ;; + --extra-dir) + EXTRA_DIR=$2 ; shift 2 + ;; + --initd-dir) + INITD_DIR=$2 ; shift 2 + ;; + --dist-dir) + DIST_DIR=$2 ; shift 2 + ;; + --) + shift ; break + ;; + *) + echo "Unknown option: $1" + usage + exit 1 + ;; + esac +done + +for var in PREFIX BUILD_DIR ; do + if [ -z "$(eval "echo \$$var")" ]; then + echo Missing param: $var + usage + fi +done + +DOC_DIR=${DOC_DIR:-/usr/share/doc/sqoop2} +LIB_DIR=${LIB_DIR:-/usr/lib/sqoop2} +BIN_DIR=${BIN_DIR:-/usr/lib/sqoop2/bin} +ETC_DIR=${ETC_DIR:-/etc/sqoop2} +MAN_DIR=${MAN_DIR:-/usr/share/man/man1} +CONF_DIR=${CONF_DIR:-${ETC_DIR}/conf.dist} +INITD_DIR=${INITD_DIR:-/etc/init.d} +DIST_DIR=${DIST_DIR:-.} +TOMCAT_CONF_DIR=${ETC_DIR}/tomcat-conf + +install -d -m 0755 ${PREFIX}/${LIB_DIR} +install -d -m 0755 ${PREFIX}/${LIB_DIR}/client-lib +install -d -m 0755 ${PREFIX}/${BIN_DIR} +install -d -m 0755 ${PREFIX}/${CONF_DIR} +install -d -m 0755 ${PREFIX}/etc/default +install -d -m 0755 ${PREFIX}/var/lib/sqoop2 + +install -m 0644 ${DIST_DIR}/shell/lib/*.jar ${PREFIX}/${LIB_DIR}/client-lib/ +install -m 0755 ${DIST_DIR}/bin/sqoop.sh ${PREFIX}/${BIN_DIR}/ +install -m 0755 ${DIST_DIR}/bin/sqoop-sys.sh ${PREFIX}/${BIN_DIR}/ + +install -m 0644 ${DIST_DIR}/server/conf/sqoop.properties ${PREFIX}/${CONF_DIR}/sqoop.properties +sed -i 's#@LOGDIR@#/var/log/sqoop2#' ${PREFIX}/${CONF_DIR}/sqoop.properties +sed -i 's#@BASEDIR@#/var/lib/sqoop2#' ${PREFIX}/${CONF_DIR}/sqoop.properties + +install -m 0644 ${DIST_DIR}/server/conf/sqoop_bootstrap.properties ${PREFIX}/${CONF_DIR} +install -m 0644 ${EXTRA_DIR}/sqoop2.default ${PREFIX}/etc/default/sqoop2-server +rm ${EXTRA_DIR}/sqoop2.default # Otherwise debhelper will re-install this + +install -m 0755 ${DIST_DIR}/server/bin/setenv.sh ${PREFIX}/${CONF_DIR}/ +sed -i -e 's#-Dsqoop.config.dir=.*conf#-Dsqoop.config.dir=/etc/sqoop2/conf#' ${PREFIX}/${CONF_DIR}/setenv.sh +ln -s ${CONF_DIR}/setenv.sh ${PREFIX}/${BIN_DIR}/ + +# Explode the WAR +SQOOP_WEBAPPS=${PREFIX}/${LIB_DIR}/webapps +cp -r ${DIST_DIR}/server/webapps $SQOOP_WEBAPPS +unzip -d $SQOOP_WEBAPPS/sqoop $SQOOP_WEBAPPS/sqoop.war + +install -m 0755 ${EXTRA_DIR}/tomcat-deployment.sh ${PREFIX}/${LIB_DIR}/tomcat-deployment.sh + +# Create MR2 configuration +install -d -m 0755 ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf +for conf in web.xml tomcat-users.xml server.xml logging.properties context.xml catalina.policy +do + install -m 0644 ${DIST_DIR}/server/conf/$conf ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/ +done +sed -i -e "s|<Host |<Host workDir=\"/var/tmp/sqoop\" |" ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/server.xml +sed -i -e "s|\${catalina\.base}/logs|/var/log/sqoop|" ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/logging.properties +cp -f ${EXTRA_DIR}/catalina.properties ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/catalina.properties +install -d -m 0755 ${PREFIX}/${TOMCAT_CONF_DIR}.dist/WEB-INF +mv $SQOOP_WEBAPPS/sqoop/WEB-INF/*.xml ${PREFIX}/${TOMCAT_CONF_DIR}.dist/WEB-INF + +# Create wrapper scripts for the client and server +client_wrapper=$PREFIX/usr/bin/sqoop2 +server_wrapper=$PREFIX/usr/bin/sqoop2-server +tool_wrapper=$PREFIX/usr/bin/sqoop2-tool +mkdir -p $PREFIX/usr/bin +install -m 0755 $EXTRA_DIR/sqoop.sh $client_wrapper +install -m 0755 $EXTRA_DIR/sqoop-server.sh $server_wrapper +install -m 0755 $EXTRA_DIR/sqoop-tool.sh $tool_wrapper + +CATALINA_HOME=/usr/lib/bigtop-tomcat +install -d ${PREFIX}/${CATALINA_HOME}/lib +install -m 0644 ${DIST_DIR}/server/lib/sqoop-tomcat*.jar ${PREFIX}/${CATALINA_HOME}/lib/ + +cp ${DIST_DIR}/{LICENSE,NOTICE}.txt ${PREFIX}/${LIB_DIR}/ + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/sqoop-server.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/sqoop-server.sh b/bigtop-packages/src/common/sqoop2/sqoop-server.sh new file mode 100644 index 0000000..1013034 --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/sqoop-server.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +# Autodetect JAVA_HOME if not defined +. /usr/lib/bigtop-utils/bigtop-detect-javahome +. /usr/lib/bigtop-utils/bigtop-detect-classpath + +LIB_DIR=${LIB_DIR:-/usr/lib} + +SQOOP_HOME=${LIB_DIR}/sqoop2 +TOMCAT_HOME=${LIB_DIR}/bigtop-tomcat + +. /usr/lib/sqoop2/tomcat-deployment.sh + +export CATALINA_BIN=${CATALINA_BIN:-${TOMCAT_HOME}/bin} +export CATALINA_BASE=${CATALINA_BASE:-${DEPLOYMENT_TARGET}} +export CATALINA_OPTS=${CATALINA_OPTS:--Xmx1024m} +export CATALINA_OUT=${CATALINE_OUT:-/var/log/sqoop2/sqoop-tomcat.log} + +env CLASSPATH=$CLASSPATH $SQOOP_HOME/bin/sqoop.sh server $@ + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/sqoop-server.svc ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/sqoop-server.svc b/bigtop-packages/src/common/sqoop2/sqoop-server.svc new file mode 100644 index 0000000..df12146 --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/sqoop-server.svc @@ -0,0 +1,112 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +DAEMON="sqoop2-server" +DESC="Sqoop Server" +EXEC_PATH="/usr/bin/sqoop2-server" +SVC_USER="${SQOOP_USER:-sqoop2}" +WORKING_DIR="/var/lib/sqoop2" +DAEMON_FLAGS="" +CONF_DIR="${SQOOP_CONFIG:-/etc/sqoop2/conf}" +PIDFILE="${SQOOP_PID:-/var/run/sqoop2/sqoop-server-$SVC_USER.pid}" + +generate_functions() { + +cat <<'__EOT__' +sqoop_env() { + export SQOOP_CONFIG + export CATALINA_BASE + export CATALINA_BIN + export CATALINA_PID=$SQOOP_PID + export CATALINA_OPTS + export CATALINA_OUT + export CATALINA_TMPDIR +} +__EOT__ + +} + +generate_start() { + +cat <<'__EOT__' +start() { + [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED + [ -d $CONF_DIR ] || exit $ERROR_PROGRAM_NOT_CONFIGURED + log_success_msg "Starting ${DESC}: " + + sqoop_env + + su -s /bin/bash -c "cd ~/ && ${EXEC_PATH} start $DAEMON_FLAGS" $SVC_USER + + for second in {5..0} + do + checkstatusofproc + RETVAL=$? + if [ "$RETVAL" -eq $RETVAL_SUCCESS ] ; then + break + fi + sleep 1 + done + + [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE + return $RETVAL +} +__EOT__ + +} + +generate_stop() { + +cat <<'__EOT__' +stop() { + # FIXME: workaround for BIGTOP-537 + checkstatusofproc + if [ "$?" = "$STATUS_RUNNING" ] ; then + + sqoop_env + + su -s /bin/bash -c "cd ~/ && ${EXEC_PATH} stop" $SVC_USER + + SQOOP_SHUTDOWN_TIMEOUT=${SQOOP_SHUTDOWN_TIMEOUT:-60} + + if [ -f $PIDFILE ]; then + PID=`cat $PIDFILE` + if [ -n $PID ]; then + kill -TERM $PID &>/dev/null + for i in `seq 1 ${SQOOP_SHUTDOWN_TIMEOUT}` ; do + kill -0 ${SQOOP_PID} &>/dev/null || break + sleep 1 + done + if [ ! kill -0 ${SQOOP_PID} &>/dev/null ]; then + kill -KILL ${SQOOP_PID} &>/dev/null + fi + fi + fi + + RETVAL=$? + else + RETVAL=$RETVAL_SUCCESS + fi + + if [ $RETVAL -eq $RETVAL_SUCCESS ]; then + rm -f $LOCKFILE $PIDFILE + log_success_msg "Stopped ${DESC}: " + else + log_failure_msg "Failed to stop ${DESC}. Return value: $RETVAL" + fi +} +__EOT__ + +} http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/sqoop-tool.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/sqoop-tool.sh b/bigtop-packages/src/common/sqoop2/sqoop-tool.sh new file mode 100644 index 0000000..45c3d7b --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/sqoop-tool.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +# Autodetect JAVA_HOME if not defined + +. /usr/lib/bigtop-utils/bigtop-detect-javahome + +export TOMCAT_DEPLOYMENT=/var/lib/sqoop2/tool-tomcat-deployment +. /usr/lib/sqoop2/tomcat-deployment.sh + +LIB_DIR=/usr/lib/sqoop2 +BIN_DIR=${LIB_DIR}/bin + +export CLASSPATH=$CLASSPATH:$(echo "$LIB_DIR"/client-lib/*.jar | tr ' ' ':') +export CATALINA_HOME=/usr/lib/bigtop-tomcat +export CATALINA_BIN=${CATALINA_HOME}/bin +export CATALINA_BASE=/var/lib/sqoop2/tool-tomcat-deployment +export JAVA_OPTS="$JAVA_OPTS -Dsqoop.config.dir=/etc/sqoop2/conf" + +COMMAND="cd ~/ && ${BIN_DIR}/sqoop.sh tool $@" +su -s /bin/bash -c "${COMMAND}" sqoop2 + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/sqoop.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/sqoop.sh b/bigtop-packages/src/common/sqoop2/sqoop.sh new file mode 100644 index 0000000..307339b --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/sqoop.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +# Autodetect JAVA_HOME if not defined +. /usr/lib/bigtop-utils/bigtop-detect-javahome + +LIB_DIR=/usr/lib/sqoop2 +BIN_DIR=${LIB_DIR}/bin + +CLASSPATH=$CLASSPATH:$(echo "$LIB_DIR"/client-lib/*.jar | tr ' ' ':') + +env CLASSPATH=$CLASSPATH $BIN_DIR/sqoop.sh client $@ + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/sqoop2.default ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/sqoop2.default b/bigtop-packages/src/common/sqoop2/sqoop2.default new file mode 100644 index 0000000..ad283e4 --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/sqoop2.default @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +CATALINA_BASE=/var/lib/sqoop2/tomcat-deployment +SQOOP_USER=sqoop2 +SQOOP_CONFIG=/etc/sqoop2/conf +SQOOP_LOG=/var/log/sqoop2 +SQOOP_TEMP=/var/run/sqoop2 +SQOOP_PID=/var/run/sqoop2/sqoop-server-sqoop2.pid +CATALINA_BIN=/usr/lib/bigtop-tomcat/bin +CATALINA_TMPDIR=/var/tmp/sqoop2 +CATALINA_OPTS=-Xmx1024m +CATALINA_OUT=/var/log/sqoop2/sqoop-tomcat.log +#AUX_CLASSPATH= + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/common/sqoop2/tomcat-deployment.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/sqoop2/tomcat-deployment.sh b/bigtop-packages/src/common/sqoop2/tomcat-deployment.sh new file mode 100644 index 0000000..96b5427 --- /dev/null +++ b/bigtop-packages/src/common/sqoop2/tomcat-deployment.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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 script must be sourced so that it can set CATALINA_BASE for the parent process + +TOMCAT_CONF=${TOMCAT_CONF:-`readlink -e /etc/sqoop2/tomcat-conf`} +TOMCAT_DEPLOYMENT=${TOMCAT_DEPLOYMENT:-/var/lib/sqoop2/tomcat-deployment} +SQOOP2_HOME=${SQOOP2_HOME:-/usr/lib/sqoop2} + +function copy_and_resolve() { + source_dir=${1} + target_dir=${2} + + # Some directories contain both configuration and binaries, so we have to copy the contents individually + mkdir -p ${target_dir} + cp -r ${source_dir}/* ${target_dir} + + for source_symlink in `find ${source_dir} -type l`; do + # This is relative to the source specifically, so that relative symlinks are consistent + symlink_location=${source_symlink/${source_dir}/} + symlink_target=`readlink -e ${source_symlink}` + if [ -n "${symlink_target}" ]; then + rm -f ${target_dir}${symlink_location} + cp -r ${symlink_target} ${target_dir}${symlink_location} + fi + done +} + +rm -rf ${TOMCAT_DEPLOYMENT} +mkdir ${TOMCAT_DEPLOYMENT} +copy_and_resolve ${TOMCAT_CONF}/conf ${TOMCAT_DEPLOYMENT}/conf +copy_and_resolve ${SQOOP2_HOME}/webapps ${TOMCAT_DEPLOYMENT}/webapps +copy_and_resolve ${TOMCAT_CONF}/WEB-INF ${TOMCAT_DEPLOYMENT}/webapps/sqoop/WEB-INF +copy_and_resolve ${SQOOP2_HOME}/bin ${TOMCAT_DEPLOYMENT}/bin + +export CATALINA_BASE=${TOMCAT_DEPLOYMENT} + +if [ -n "${BIGTOP_CLASSPATH}" ] ; then + sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${TOMCAT_DEPLOYMENT}/conf/catalina.properties +fi + +chown -R sqoop2:sqoop ${TOMCAT_DEPLOYMENT} + +export CATALINA_BASE=${TOMCAT_DEPLOYMENT} + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/changelog ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/changelog b/bigtop-packages/src/deb/sqoop/changelog index d4858cd..547ed02 100644 --- a/bigtop-packages/src/deb/sqoop/changelog +++ b/bigtop-packages/src/deb/sqoop/changelog @@ -1 +1 @@ ---- This is auto-generated +--- This is auto-generated http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/compat ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/compat b/bigtop-packages/src/deb/sqoop/compat index 4d446d8..7f8f011 100644 --- a/bigtop-packages/src/deb/sqoop/compat +++ b/bigtop-packages/src/deb/sqoop/compat @@ -1,2 +1 @@ 7 - http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/control ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/control b/bigtop-packages/src/deb/sqoop/control index 44eba19..eec2495 100644 --- a/bigtop-packages/src/deb/sqoop/control +++ b/bigtop-packages/src/deb/sqoop/control @@ -16,24 +16,20 @@ Source: sqoop Section: misc Priority: extra Maintainer: Bigtop <[email protected]> +Build-Depends: debhelper (>= 7.0.50~), asciidoc, xmlto Standards-Version: 3.8.0 -Homepage: http://sqoop.apache.org +Homepage: http://sqoop.apache.org/ Package: sqoop Architecture: all -Depends: bigtop-utils (>= 0.7), hadoop-client, bigtop-tomcat, sqoop-client (= ${source:Version}) -Description: Tool for easy imports and exports of data sets between databases and the Hadoop ecosystem +Depends: bigtop-utils (>= 0.7), hadoop-client, adduser +Description: Tool for easy imports and exports of data sets between databases and HDFS Sqoop is a tool that provides the ability to import and export data sets between the Hadoop Distributed File System (HDFS) and relational databases. -Package: sqoop-client -Architecture: all -Depends: bigtop-utils (>= 0.7) -Description: Client for Sqoop. - Lightweight client for Sqoop. - -Package: sqoop-server +Package: sqoop-metastore Architecture: all Depends: sqoop (= ${source:Version}) -Description: Server for Sqoop. - Centralized server for Sqoop. +Description: Shared metadata repository for Sqoop. + This optional package hosts a metadata server for Sqoop clients across a network to use. + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/copyright ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/copyright b/bigtop-packages/src/deb/sqoop/copyright index fa3369a..ae4dba6 100644 --- a/bigtop-packages/src/deb/sqoop/copyright +++ b/bigtop-packages/src/deb/sqoop/copyright @@ -1,9 +1,13 @@ Format: http://dep.debian.net/deps/dep5 -Source: http://sqoop.apache.org +Source: http://sqoop.apache.org/ Upstream-Name: Sqoop +Files * +Copyright: 2011, The Apache Software Foundation +License: Apache-2.0 + Files debian/* -Copyright: 2013, The Apache Software Foundation +Copyright: 2011, The Apache Software Foundation License: Apache-2.0 License: Apache-2.0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/rules ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/rules b/bigtop-packages/src/deb/sqoop/rules index 3ee27f9..007ec2b 100755 --- a/bigtop-packages/src/deb/sqoop/rules +++ b/bigtop-packages/src/deb/sqoop/rules @@ -14,7 +14,7 @@ # 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. -# + # -*- makefile -*- # Uncomment this to turn on verbose mode. @@ -27,18 +27,13 @@ export DH_OPTIONS dh $@ override_dh_auto_build: - # There's no good way to get the RAT plugin to ignore the debian/ directory, so bigtop-empty is used as a decoy - rm -rf bigtop-empty - mkdir -p bigtop-empty - env FULL_VERSION=${SQOOP_VERSION} bash debian/do-component-build \ - -Drat.basedir=$${PWD}/bigtop-empty -Dmaven.repo.local=${HOME}/.m2/repository + bash debian/do-component-build override_dh_auto_install: - sh -x debian/install_sqoop.sh \ - --build-dir=build/sqoop-${SQOOP_VERSION} \ - --doc-dir=/usr/share/doc/sqoop \ - --prefix=debian/tmp \ - --extra-dir=debian - bash debian/init.d.tmpl debian/sqoop-server.svc deb debian/tmp/etc/init.d/sqoop-server - dh_install --sourcedir=debian/tmp - + bash -x debian/install_sqoop.sh \ + --build-dir=build/sqoop-* \ + --doc-dir=usr/share/doc/sqoop \ + --conf-dir=/etc/sqoop/conf.dist \ + --prefix=debian/sqoop \ + --extra-dir=debian/ + cp debian/sqoop-metastore.sh debian/sqoop-metastore.init http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop-client.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop-client.install b/bigtop-packages/src/deb/sqoop/sqoop-client.install deleted file mode 100644 index 8421bd5..0000000 --- a/bigtop-packages/src/deb/sqoop/sqoop-client.install +++ /dev/null @@ -1,7 +0,0 @@ -/usr/bin/sqoop -/usr/bin/sqoop-tool -/usr/lib/sqoop/bin/sqoop.sh -/usr/lib/sqoop/client-lib -/usr/lib/sqoop/LICENSE.txt -/usr/lib/sqoop/NOTICE.txt - http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop-metastore.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop-metastore.postinst b/bigtop-packages/src/deb/sqoop/sqoop-metastore.postinst new file mode 100644 index 0000000..6d84e19 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop/sqoop-metastore.postinst @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +# postinst script for sqoop + +set -e + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop-server.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop-server.install b/bigtop-packages/src/deb/sqoop/sqoop-server.install deleted file mode 100644 index 49505ce..0000000 --- a/bigtop-packages/src/deb/sqoop/sqoop-server.install +++ /dev/null @@ -1 +0,0 @@ -/etc/init.d/sqoop-server http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop-server.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop-server.postinst b/bigtop-packages/src/deb/sqoop/sqoop-server.postinst deleted file mode 100644 index e7a3396..0000000 --- a/bigtop-packages/src/deb/sqoop/sqoop-server.postinst +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF 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. - -set -e -if [ -x "/etc/init.d/sqoop-server" ]; then - update-rc.d sqoop-server defaults > /dev/null || exit 1 - invoke-rc.d sqoop-server start || : -fi http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop.install b/bigtop-packages/src/deb/sqoop/sqoop.install deleted file mode 100644 index a5011a9..0000000 --- a/bigtop-packages/src/deb/sqoop/sqoop.install +++ /dev/null @@ -1,10 +0,0 @@ -/usr/bin/sqoop-server -/etc/sqoop -/etc/default/sqoop-server -/usr/lib/sqoop/bin/setenv.sh -/usr/lib/sqoop/bin/sqoop-sys.sh -/usr/lib/sqoop/webapps -/usr/lib/sqoop/tomcat-deployment.sh -/var/lib/sqoop -/usr/lib/bigtop-tomcat/lib/sqoop-tomcat*.jar - http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop.postinst b/bigtop-packages/src/deb/sqoop/sqoop.postinst index c86139a..ac85002 100644 --- a/bigtop-packages/src/deb/sqoop/sqoop.postinst +++ b/bigtop-packages/src/deb/sqoop/sqoop.postinst @@ -14,8 +14,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +# postinst script for sqoop + set -e -update-alternatives --install /etc/sqoop/conf sqoop-conf /etc/sqoop/conf.dist 30 -update-alternatives --install /etc/sqoop/tomcat-conf sqoop-tomcat-conf /etc/sqoop/tomcat-conf.dist 30 +case "$1" in + configure) + # Install config alternatives + update-alternatives --install /etc/sqoop/conf sqoop-conf /etc/sqoop/conf.dist 30 + + chown sqoop:sqoop /var/lib/sqoop + chmod 755 /var/lib/sqoop + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac +#DEBHELPER# http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop.preinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop.preinst b/bigtop-packages/src/deb/sqoop/sqoop.preinst index 1d0e878..56d7e73 100644 --- a/bigtop-packages/src/deb/sqoop/sqoop.preinst +++ b/bigtop-packages/src/deb/sqoop/sqoop.preinst @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/sh +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -13,8 +14,8 @@ # 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. -# -# preinst script for sqoop-server + +# preinst script for sqoop # # see: dh_installdeb(1) @@ -36,14 +37,13 @@ case "$1" in adduser \ --system \ --group \ - --home /var/run/sqoop \ + --home /var/lib/sqoop \ --gecos "Sqoop User" \ --shell /bin/false \ sqoop >/dev/null fi - install -d -m 0755 -o sqoop -g sqoop /var/log/sqoop - install -d -m 0755 -o sqoop -g sqoop /var/lib/sqoop - install -d -m 0755 -o sqoop -g sqoop /var/tmp/sqoop + install -d -m 0755 -o sqoop -g sqoop /var/lib/sqoop + install -d -m 0755 -o sqoop -g sqoop /var/log/sqoop ;; abort-upgrade) http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop/sqoop.prerm ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop/sqoop.prerm b/bigtop-packages/src/deb/sqoop/sqoop.prerm index 8ca557d..5ee82f2 100644 --- a/bigtop-packages/src/deb/sqoop/sqoop.prerm +++ b/bigtop-packages/src/deb/sqoop/sqoop.prerm @@ -15,16 +15,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -# prerm script for sqoop +# prerm script for sqoop # # see: dh_installdeb(1) set -e +# summary of how this script can be called: +# * <prerm> `remove' +# * <old-prerm> `upgrade' <new-version> +# * <new-prerm> `failed-upgrade' <old-version> +# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version> +# * <deconfigured's-prerm> `deconfigure' `in-favour' +# <package-being-installed> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + case "$1" in remove|upgrade|deconfigure) update-alternatives --remove sqoop-conf /etc/sqoop/conf.dist || : - update-alternatives --remove sqoop-tomcat-conf /etc/sqoop/tomcat-conf.dist || : ;; failed-upgrade) http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/changelog ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/changelog b/bigtop-packages/src/deb/sqoop2/changelog new file mode 100644 index 0000000..d4858cd --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/changelog @@ -0,0 +1 @@ +--- This is auto-generated http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/compat ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/compat b/bigtop-packages/src/deb/sqoop2/compat new file mode 100644 index 0000000..4d446d8 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/compat @@ -0,0 +1,2 @@ +7 + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/control ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/control b/bigtop-packages/src/deb/sqoop2/control new file mode 100644 index 0000000..0ab8d59 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/control @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. +Source: sqoop2 +Section: misc +Priority: extra +Maintainer: Bigtop <[email protected]> +Standards-Version: 3.8.0 +Homepage: http://sqoop.apache.org + +Package: sqoop2 +Architecture: all +Depends: bigtop-utils (>= 0.7), hadoop-client, bigtop-tomcat (>= 0.7), sqoop2-client (= ${source:Version}) +Description: Tool for easy imports and exports of data sets between databases and the Hadoop ecosystem + Sqoop is a tool that provides the ability to import and export data sets between + the Hadoop Distributed File System (HDFS) and relational databases. In Sqoop 2, the tool + consists of a server that is configured to interface with the Hadoop cluster, and a + lightweight client for executing imports and exports on the server. + +Package: sqoop2-client +Architecture: all +Depends: bigtop-utils (>= 0.7) +Description: Lightweight client for Sqoop 2. + +Package: sqoop2-server +Architecture: all +Depends: sqoop2 (= ${source:Version}) +Description: Server for Sqoop 2. http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/copyright ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/copyright b/bigtop-packages/src/deb/sqoop2/copyright new file mode 100644 index 0000000..fa3369a --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/copyright @@ -0,0 +1,11 @@ +Format: http://dep.debian.net/deps/dep5 +Source: http://sqoop.apache.org +Upstream-Name: Sqoop + +Files debian/* +Copyright: 2013, The Apache Software Foundation +License: Apache-2.0 + +License: Apache-2.0 + On Debian systems, the complete text of the Apache 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/rules ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/rules b/bigtop-packages/src/deb/sqoop2/rules new file mode 100755 index 0000000..fbd823a --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/rules @@ -0,0 +1,44 @@ +#!/usr/bin/make -f +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. +# +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +%: + dh $@ + +override_dh_auto_build: + # There's no good way to get the RAT plugin to ignore the debian/ directory, so bigtop-empty is used as a decoy + rm -rf bigtop-empty + mkdir -p bigtop-empty + bash debian/do-component-build \ + -Drat.basedir=$${PWD}/bigtop-empty + +override_dh_auto_install: + bash -x debian/install_sqoop2.sh \ + --build-dir=build/sqoop2-* \ + --doc-dir=/usr/share/doc/sqoop2 \ + --prefix=debian/tmp \ + --extra-dir=debian \ + --dist-dir=dist/target/sqoop2-* + bash debian/init.d.tmpl debian/sqoop-server.svc deb debian/tmp/etc/init.d/sqoop2-server + dh_install --sourcedir=debian/tmp http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/source/format ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/source/format b/bigtop-packages/src/deb/sqoop2/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/source/format @@ -0,0 +1 @@ +3.0 (quilt) http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/sqoop2-client.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/sqoop2-client.install b/bigtop-packages/src/deb/sqoop2/sqoop2-client.install new file mode 100644 index 0000000..4a4aa02 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/sqoop2-client.install @@ -0,0 +1,6 @@ +/usr/bin/sqoop2 +/usr/lib/sqoop2/bin/sqoop.sh +/usr/lib/sqoop2/client-lib +/usr/lib/sqoop2/LICENSE.txt +/usr/lib/sqoop2/NOTICE.txt + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/sqoop2-server.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/sqoop2-server.install b/bigtop-packages/src/deb/sqoop2/sqoop2-server.install new file mode 100644 index 0000000..2a0e48f --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/sqoop2-server.install @@ -0,0 +1 @@ +/etc/init.d/sqoop2-server http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/sqoop2-server.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/sqoop2-server.postinst b/bigtop-packages/src/deb/sqoop2/sqoop2-server.postinst new file mode 100644 index 0000000..fe59f06 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/sqoop2-server.postinst @@ -0,0 +1,21 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +set -e +if [ -x "/etc/init.d/sqoop2-server" ]; then + update-rc.d sqoop2-server defaults > /dev/null || exit 1 + invoke-rc.d sqoop2-server start || : +fi http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/sqoop2.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/sqoop2.install b/bigtop-packages/src/deb/sqoop2/sqoop2.install new file mode 100644 index 0000000..e39f408 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/sqoop2.install @@ -0,0 +1,11 @@ +/usr/bin/sqoop2-server +/usr/bin/sqoop2-tool +/etc/sqoop2 +/etc/default/sqoop2-server +/usr/lib/sqoop2/bin/setenv.sh +/usr/lib/sqoop2/bin/sqoop-sys.sh +/usr/lib/sqoop2/webapps +/usr/lib/sqoop2/tomcat-deployment.sh +/var/lib/sqoop2 +/usr/lib/bigtop-tomcat/lib/sqoop-tomcat*.jar + http://git-wip-us.apache.org/repos/asf/bigtop/blob/a241ffb3/bigtop-packages/src/deb/sqoop2/sqoop2.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/sqoop2/sqoop2.postinst b/bigtop-packages/src/deb/sqoop2/sqoop2.postinst new file mode 100644 index 0000000..de15158 --- /dev/null +++ b/bigtop-packages/src/deb/sqoop2/sqoop2.postinst @@ -0,0 +1,21 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +set -e + +update-alternatives --install /etc/sqoop2/conf sqoop2-conf /etc/sqoop2/conf.dist 30 +update-alternatives --install /etc/sqoop2/tomcat-conf sqoop2-tomcat-conf /etc/sqoop2/tomcat-conf.dist 30 +
