<commit_before>#!/bin/bash
#
# Copyright 2015, Cloudera Inc.
#
# All rights reserved - Do Not Redistribute
#

if [ $USER != "root" ]; then
  echo "install.sh must be run as root (sudo ./install.sh)"
  exit 1
fi

USER=$SUDO_USER
USER_HOME=$(eval echo ~${SUDO_USER})

chef_binary=/usr/bin/chef-solo
# Are we on a vanilla system?
if ! test -f "$chef_binary"; then
  export DEBIAN_FRONTEND=noninteractive
  # Install Chef
  curl -L https://www.opscode.com/chef/install.sh | bash
fi

cd $USER_HOME
if ! test -d impala-setup; then
  sudo -u $USER git clone http://github.mtv.cloudera.com/dtsirogiannis/impala-setup.git
  cd impala-setup
else
  cd impala-setup
  sudo -u $USER git pull
fi

sudo -u $USER sed -i "s/username = ''/username = '$USER'/" cookbooks/impala/attributes/default.rb
"$chef_binary" -c solo.rb -j impala.json<commit_msg>Install git in the bootstrap script<commit_after>#!/bin/bash
#
# Copyright 2015, Cloudera Inc.
#
# All rights reserved - Do Not Redistribute
#

if [ $USER != "root" ]; then
  echo "install.sh must be run as root (sudo ./install.sh)"
  exit 1
fi

USER=$SUDO_USER
USER_HOME=$(eval echo ~${SUDO_USER})

chef_binary=/usr/bin/chef-solo
# Are we on a vanilla system?
if ! test -f "$chef_binary"; then
  export DEBIAN_FRONTEND=noninteractive
  # Install Chef
  curl -L https://www.opscode.com/chef/install.sh | bash
fi

# Install git
sudo apt-get install -y git

cd $USER_HOME
if ! test -d impala-setup; then
  sudo -u $USER git clone http://github.mtv.cloudera.com/dtsirogiannis/impala-setup.git
  cd impala-setup
else
  cd impala-setup
  sudo -u $USER git pull
fi

# Run chef-solo to configure the Impala dev machine
sudo -u $USER sed -i "s/username = ''/username = '$USER'/" cookbooks/impala/attributes/default.rb
"$chef_binary" -c solo.rb -j impala.json
{'fraction_non_alphanumeric': 0.12955692652832304, 'fraction_numerical': 0.005608524957936063, 'mean_word_length': 3.6824146981627295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4568803', 'n_tokens_mistral': 698, 'n_tokens_neox': 665, 'n_words': 199}