#!/bin/bash # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Common functions for hudson build scripts # # Use $CDH_URL to control where to download Hadoop. # If not specified, it uses the $CDH variable to select an archive location. # CDH_URL=${CDH_URL:-http://nightly.cloudera.com/cdh4/cdh/4/hadoop-0.23.1-cdh4b2-SNAPSHOT.tar.gz} CDH_TGZ=$(basename $CDH_URL) CDH_VERSION=${CDH_TGZ/.tar.gz/} CDH_CACHE="$HOME/.hue_cache/${CDH_TGZ}" build_hadoop() { if [ ! -f $CDH_CACHE ]; then mkdir -p $HOME/.hue_cache echo "Downloading $CDH_URL..." wget $CDH_URL -O $CDH_CACHE fi HADOOP_DIR=$HUE_ROOT/ext/hadoop export HADOOP_HDFS_HOME="$HADOOP_DIR/${CDH_VERSION}" export HADOOP_BIN=$HADOOP_HDFS_HOME/bin/hadoop mkdir -p $HADOOP_DIR rm -rf $HADOOP_HOME echo "Unpacking $CDH_CACHE to $HADOOP_DIR" tar -C $HADOOP_DIR -xzf $CDH_CACHE } ########## MR1_URL=${MR1_URL:-http://nightly.cloudera.com/cdh4/cdh/4/mr1-0.23.1-mr1-cdh4b2-SNAPSHOT.tar.gz} MR1_TGZ=$(basename $MR1_URL) MR1_VERSION=${MR1_TGZ/.tar.gz/} MR1_VERSION=${MR1_VERSION/mr1/hadoop} MR1_CACHE="$HOME/.hue_cache/${MR1_TGZ}" build_mr1() { if [ ! -f $MR1_CACHE ]; then mkdir -p $HOME/.hue_cache echo "Downloading $MR1_URL..." wget $MR1_URL -O $MR1_CACHE fi MR1_DIR=$HUE_ROOT/ext/mr1 export HADOOP_MR1_HOME="$MR1_DIR/${MR1_VERSION}" export HADOOP_MR1_BIN="$HADOOP_MR1_HOME/bin/hadoop" mkdir -p $MR1_DIR rm -rf $HADOOP_MR1_HOME echo "Unpacking $MR1_CACHE to $MR1_DIR" tar -C $MR1_DIR -xzf $MR1_CACHE } ########## HIVE_URL=${HIVE_URL:-http://nightly.cloudera.com/cdh4/cdh/4/hive-0.8.1-cdh4b2-SNAPSHOT.tar.gz} HIVE_TGZ=$(basename $HIVE_URL) HIVE_VERSION=${HIVE_TGZ/.tar.gz/} HIVE_CACHE="$HOME/.hue_cache/${HIVE_TGZ}" build_hive() { if [ ! -f $HOME/.hue_cache ]; then mkdir -p $HOME/.hue_cache echo "Downloading $HIVE_URL..." wget $HIVE_URL -O $HIVE_CACHE fi HIVE_DIR=$HUE_ROOT/ext/hive export HIVE_HOME="$HIVE_DIR/${HIVE_VERSION}" mkdir -p $HIVE_DIR rm -rf $HIVE_HOME echo "Unpacking $HIVE_CACHE to $HIVE_DIR" tar -C $HIVE_DIR -xzf $HIVE_CACHE export HIVE_CONF_DIR=$HIVE_HOME/conf }