#!/bin/bash

if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

echo "##############################################################"
echo "##                                                          ##"
echo "## WARNING: this element (hadoop-cdh) has been deprecated   ##"
echo "##          Please use the hadoop-cloudera element          ##"
echo "##                                                          ##"
echo "##############################################################"

if [ -z "${JAVA_DOWNLOAD_URL:-}" ]; then
    if [ -z "${JAVA_FILE:-}" ]; then
        echo "JAVA_FILE and JAVA_DOWNLOAD_URL are not set. Proceeding with distro native Java."
    fi
fi
if [ -z "$DIB_CDH_VERSION" ]; then
    echo "DIB_CDH_VERSION is not set. Impossible to install hadoop. Exit"
    exit 1
fi
if [ $DIB_CDH_VERSION != "CDH4" ]; then
    echo "CDH version $DIB_CDH_VERSION not supported. Exiting."
    exit 1
fi
