<commit_before>#!/bin/bash

set -e

while getopts "p:" opt; do
  case $opt in
    p)
      PLUGIN=$OPTARG
    ;;
    *)
      echo
      echo "Usage: $0 [-p vanilla|spark]"
      echo "By default the vanilla plugin will be selected"
      exit
    ;;
  esac
done

# Default
if [ -z "$PLUGIN" ]; then
  PLUGIN="vanilla"
fi
# Sanity checks
if [ "$PLUGIN" != "vanilla" -a "$PLUGIN" != "spark" ]; then
  echo -e "Unknown plugin selected.\nAborting"
  exit 1
fi
echo "Selected Savanna plugin $PLUGIN"

# Export variables for elements
if [ $PLUGIN = "spark" ]; then
  export DIB_HADOOP_VERSION="2.0.0-mr1-cdh4.5.0"
elif [ $PLUGIN = "vanilla" ]; then
  export DIB_HADOOP_VERSION="1.2.1"
  export fedora_image_name="fedora_savanna_latest"
  export centos_image_name="centos_savanna_latest"
  export OOZIE_DOWNLOAD_URL="http://savanna-files.mirantis.com/oozie-4.0.0.tar.gz"
  export HIVE_VERSION="0.11.0"
fi
export JAVA_DOWNLOAD_URL="http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.tar.gz"
export ubuntu_image_name="ubuntu_savanna_latest"

if [ -e /etc/os-release ]; then
  platform=$(head -1 /etc/os-release)
  if [ $platform = 'NAME="Ubuntu"' ]; then
    apt-get update -y
    apt-get install qemu kpartx git -y
  elif [ $platform = 'NAME=Fedora' ]; then
    yum update -y
    yum install qemu kpartx git -y
  fi
else
  platform=$(head -1 /etc/system-release | grep CentOS)
  if [ -z $platform ]; then
    yum update -y
    yum install qemu-kvm kpartx git -y
  else
    echo -e "Unknown Host OS. Impossible to build images.\nAborting"
  fi
fi

base_dir="$(dirname $(readlink -e $0))"

TEMP=$(mktemp -d diskimage-create.XXXXXX)
pushd $TEMP

export DIB_IMAGE_CACHE=$TEMP/.cache-image-create

# Working with repositories<commit_msg>Add ability to use environment variables<commit_after>#!/bin/bash

set -e

while getopts "p:" opt; do
  case $opt in
    p)
      PLUGIN=$OPTARG
    ;;
    *)
      echo
      echo "Usage: $0 [-p vanilla|spark]"
      echo "By default the vanilla plugin will be selected"
      exit
    ;;
  esac
done

# Default
if [ -z "$PLUGIN" ]; then
  PLUGIN="vanilla"
fi
# Sanity checks
if [ "$PLUGIN" != "vanilla" -a "$PLUGIN" != "spark" ]; then
  echo -e "Unknown plugin selected.\nAborting"
  exit 1
fi
echo "Selected Savanna plugin $PLUGIN"

# Export variables for elements
if [ $PLUGIN = "spark" ]; then
  export DIB_HADOOP_VERSION="2.0.0-mr1-cdh4.5.0"
elif [ $PLUGIN = "vanilla" ]; then
  export DIB_HADOOP_VERSION=${DIB_HADOOP_VERSION:-"1.2.1"}
  export fedora_image_name="fedora_savanna_latest"
  export centos_image_name="centos_savanna_latest"
  export OOZIE_DOWNLOAD_URL=${OOZIE_DOWNLOAD_URL:-"http://savanna-files.mirantis.com/oozie-4.0.0.tar.gz"}
  export HIVE_VERSION=${HIVE_VERSION:-"0.11.0"}
fi
export JAVA_DOWNLOAD_URL=${JAVA_DOWNLOAD_URL:-"http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.tar.gz"}
export ubuntu_image_name="ubuntu_savanna_latest"

if [ -e /etc/os-release ]; then
  platform=$(head -1 /etc/os-release)
  if [ $platform = 'NAME="Ubuntu"' ]; then
    apt-get update -y
    apt-get install qemu kpartx git -y
  elif [ $platform = 'NAME=Fedora' ]; then
    yum update -y
    yum install qemu kpartx git -y
  fi
else
  platform=$(head -1 /etc/system-release | grep CentOS)
  if [ -z $platform ]; then
    yum update -y
    yum install qemu-kvm kpartx git -y
  else
    echo -e "Unknown Host OS. Impossible to build images.\nAborting"
  fi
fi

base_dir="$(dirname $(readlink -e $0))"

TEMP=$(mktemp -d diskimage-create.XXXXXX)
pushd $TEMP

export DIB_IMAGE_CACHE=$TEMP/.cache-image-create

# Working with repositories
{'fraction_non_alphanumeric': 0.1365149833518313, 'fraction_numerical': 0.017758046614872364, 'mean_word_length': 3.4727047146401984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6702145', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1381, 'n_words': 340}