<commit_before>#!/bin/bash

# Make the build fail on errors.
set -e

# Strip the first part to avoid credentials leaks.
echo "repository=$(echo $repository | sed s/^.*@//g)"
echo "package_type=$package_type"
echo "packages=$packages"
echo "upgrade=$upgrade"

# Strip leading/trailing quotes if present.
repository=`echo $repository | sed 's/^"\(.*\)"$/\1/'`

# Strip leading/trailing quotes if present.
# Also convert a comma-separated list to a whitespace-separated one.
packages=`echo $packages | sed 's/^"\(.*\)"$/\1/' | sed 's/,/ /g'`


function provision_deb() {
  # https://www.packer.io/docs/builders/amazon-chroot.html look at gotchas at the end.
  if [[ "$disable_services" == "true" ]]; then
    echo "creating /usr/sbin/policy-rc.d to prevent services from being started"
    echo '#!/bin/sh' | sudo tee /usr/sbin/policy-rc.d > /dev/null
    echo 'exit 101' | sudo tee -a /usr/sbin/policy-rc.d > /dev/null
    sudo chmod a+x /usr/sbin/policy-rc.d
  fi

  if [[ "$repository" != "" ]]; then
    echo "deb $repository" | sudo tee /etc/apt/sources.list.d/spinnaker.list > /dev/null
  fi

  sudo apt-get update
  if [[ "$upgrade" == "true" ]]; then
    sudo unattended-upgrade -v<commit_msg>Changed provision_deb so it can take multiple repos (#107)<commit_after>#!/bin/bash

# Make the build fail on errors.
set -e

# Strip the first part to avoid credentials leaks.
echo "repository=$(echo $repository | sed s/^.*@//g)"
echo "package_type=$package_type"
echo "packages=$packages"
echo "upgrade=$upgrade"

# Strip leading/trailing quotes if present.
repository=`echo $repository | sed 's/^"\(.*\)"$/\1/'`

# Strip leading/trailing quotes if present.
# Also convert a comma-separated list to a whitespace-separated one.
packages=`echo $packages | sed 's/^"\(.*\)"$/\1/' | sed 's/,/ /g'`


function provision_deb() {
  # https://www.packer.io/docs/builders/amazon-chroot.html look at gotchas at the end.
  if [[ "$disable_services" == "true" ]]; then
    echo "creating /usr/sbin/policy-rc.d to prevent services from being started"
    echo '#!/bin/sh' | sudo tee /usr/sbin/policy-rc.d > /dev/null
    echo 'exit 101' | sudo tee -a /usr/sbin/policy-rc.d > /dev/null
    sudo chmod a+x /usr/sbin/policy-rc.d
  fi

  if [[ "$repository" != "" ]]; then
    IFS=';' read -ra repo <<< "$repository"
    for i in "${repo[@]}"; do
      echo "deb $i" | sudo tee -a /etc/apt/sources.list.d/spinnaker.list > /dev/null
    done
  fi

  sudo apt-get update
  if [[ "$upgrade" == "true" ]]; then
    sudo unattended-upgrade -v
{'fraction_non_alphanumeric': 0.173015873015873, 'fraction_numerical': 0.005158730158730159, 'mean_word_length': 3.302047781569966, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 9, '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': '5618482', 'n_tokens_mistral': 940, 'n_tokens_neox': 865, 'n_words': 259}