<commit_before>#!/usr/bin/env bash

PACKER_URL="https://releases.hashicorp.com/packer"
PACKER_VER="0.8.6"
PACKER_SUM="2f1ca794e51de831ace30792ab0886aca516bf6b407f6027e816ba7ca79703b5"
PACKER_ZIP="packer_${PACKER_VER}_linux_amd64.zip"

cd "$(dirname $0)/../"

if [ ! -d vendor ] ; then mkdir vendor; fi
if [ ! -d vendor ] ; then mkdir vendor/bin; fi
if [ ! -d vendor ] ; then mkdir vendor/cache; fi

# we need unzip
if ! which unzip; then
  # redhat
  if which yum ; then
    sudo yum install unzip
  elif which apt-get ; then
    sudo apt-get install unzip
  else
    echo "ERROR: unzip not found and cannot install"
  fi
fi

wget -O vendor/cache/$PACKER_ZIP $PACKER_URL/$PACKER_VER/PACKER_ZIP
pushd vendor/cache
echo "$PACKER_SUM  $PACKER_ZIP" | shasum -c
popd

unzip vendor/cache/$PACKER_ZIP -d vendor/bin/
<commit_msg>Adding sudo check and chefdk install<commit_after>#!/usr/bin/env bash

PACKER_URL="https://releases.hashicorp.com/packer"
PACKER_VER="0.8.6"
PACKER_SUM="2f1ca794e51de831ace30792ab0886aca516bf6b407f6027e816ba7ca79703b5"
PACKER_ZIP="packer_${PACKER_VER}_linux_amd64.zip"

cd "$(dirname $0)/../"

if [ ! -d vendor ] ; then mkdir vendor; fi
if [ ! -d vendor ] ; then mkdir vendor/bin; fi
if [ ! -d vendor ] ; then mkdir vendor/cache; fi

# Sudo is necessary for this setup.

if $(sudo sh -c true; echo $0) -ne "0"; then
  echo "ERROR: User needs to be able to sudo"
  exit 1
fi

# we need unzip
if ! which unzip; then
  # redhat
  if which yum ; then
    sudo yum install unzip
  elif which apt-get ; then
    sudo apt-get install unzip
  else
    echo "ERROR: unzip not found and cannot install"
    exit 0
  fi
fi

# We also need ChefDK
curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -c current -P chefdk

wget -O vendor/cache/$PACKER_ZIP $PACKER_URL/$PACKER_VER/PACKER_ZIP
pushd vendor/cache
echo "$PACKER_SUM  $PACKER_ZIP" | shasum -c
popd

unzip vendor/cache/$PACKER_ZIP -d vendor/bin/

{'fraction_non_alphanumeric': 0.11296199895887558, 'fraction_numerical': 0.04997397188964081, 'mean_word_length': 3.781094527363184, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, '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': '5582119', 'n_tokens_mistral': 831, 'n_tokens_neox': 758, 'n_words': 212}