<commit_before>#!/bin/bash -e

# Expected to be run in the root of the Chef Git repository (e.g. chef-bcpc)

set -x

if [[ -f ./proxy_setup.sh ]]; then
	. ./proxy_setup.sh
fi

# make sure we do not have a previous .chef directory in place to allow re-runs
if [[ -f .chef/knife.rb ]]; then
  mv .chef/ ".chef_found_$(date +"%m-%d-%Y %H:%m:%S")"
fi
echo -e ".chef/knife.rb\nhttp://10.0.100.1:4000\n\n\n\n\n\n\n" | knife configure --initial

cp -p .chef/knife.rb .chef/knife-proxy.rb

if [[ ! -z "$http_proxy" ]]; then
	echo  "http_proxy  \"${http_proxy}\"" >> .chef/knife-proxy.rb
	echo "https_proxy \"${https_proxy}\"" >> .chef/knife-proxy.rb
fi

cd cookbooks

for i in apt ubuntu cron chef-client; do
  if [[ ! -d $i ]]; then
	# unless the proxy was defined this knife config will be the same as the one generated above
    knife cookbook site download $i --config ../.chef/knife-proxy.rb
    tar zxf $i*.tar.gz<commit_msg>setup_chef_cookbooks.sh: Allow for re-run if we're blowing away .chef; detab.<commit_after>#!/bin/bash -e

# Expected to be run in the root of the Chef Git repository (e.g. chef-bcpc)

set -x

if [[ -f ./proxy_setup.sh ]]; then
  . ./proxy_setup.sh
fi

# make sure we do not have a previous .chef directory in place to allow re-runs
if [[ -f .chef/knife.rb ]]; then
  knife node delete `hostname -f` -y || true
  knife client delete root -y || true
  mv .chef/ ".chef_found_$(date +"%m-%d-%Y %H:%M:%S")"
fi
echo -e ".chef/knife.rb\nhttp://10.0.100.1:4000\n\n\n\n\n\n.\n" | knife configure --initial

cp -p .chef/knife.rb .chef/knife-proxy.rb

if [[ ! -z "$http_proxy" ]]; then
  echo  "http_proxy  \"${http_proxy}\"" >> .chef/knife-proxy.rb
  echo "https_proxy \"${https_proxy}\"" >> .chef/knife-proxy.rb
fi

cd cookbooks

for i in apt ubuntu cron chef-client; do
  if [[ ! -d $i ]]; then
     # unless the proxy was defined this knife config will be the same as the one generated above
    knife cookbook site download $i --config ../.chef/knife-proxy.rb
    tar zxf $i*.tar.gz
{'fraction_non_alphanumeric': 0.1664167916041979, 'fraction_numerical': 0.010994502748625687, 'mean_word_length': 2.91015625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '479619', 'n_tokens_mistral': 805, 'n_tokens_neox': 782, 'n_words': 247}