<commit_before>#!/bin/bash

set -e

prod=false
while getopts "p" opt; do
    case $opt in
        p)
            prod=true
            ;;
    esac
done

color() {
      printf '\033[%sm%s\033[m\n' "$@"
      # usage color "31;5" "string"
      # 0 default
      # 5 blink, 1 strong, 4 underlined
      # fg: 31 red,  32 green, 33 yellow, 34 blue, 35 purple, 36 cyan, 37 white
      # bg: 40 black, 41 red, 44 blue, 45 purple
      }

color '36;1' "
      _   _       _
     | \ | |_   _| | __ _ ___
     |  \| | | | | |/ _' / __|
     | |\  | |_| | | (_| \__ \\
     |_| \_|\__, |_|\__,_|___/
            |___/

     This script installs dependencies for the Nylas Sync Engine.

     For more details, visit:
     https://www.github.com/nylas/sync-engine
"

if ! [ -e ./setup.py ] || ! [ -e ./setup.sh ] ; then
    color '31;1' "Error: setup.sh should be run from the sync-engine repo" >&2
    exit 1
fi

color '35;1' 'Updating packages...'


if command -v mysql >/dev/null 2>&1
then
    echo "MySQL Exists. Not adding upstream mysql package";
else
    echo "Adding MySQL APT Repo";
    #Trust MySQL APT Repo
    echo "deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6" > /etc/apt/sources.list.d/mysql.list;
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5072E1F5;
fi

# Don't fail builds if apt-get update fails (eg due to ksplice being down)
set +e
apt-get update
set -e

apt-get -y install python-software-properties


{ \
echo "mysql-community-server mysql-community-server/data-dir select ''"; \
echo "mysql-community-server mysql-community-server/root-pass password <PASSWORD>"; \
echo "mysql-community-server mysql-community-server/re-root-pass password root"; \
echo "mysql-community-server mysql-community-server/remove-test-db select false"; \
echo "mysql-server mysql-server/root_password password <PASSWORD>";
echo "mysql-server mysql-server/root_password_again password root";
  } | sudo debconf-set-selections



color '35;1' 'Installing dependencies from apt-get...'
apt-get -y install git \<commit_msg>Include mercurial in the VM's dependency list<commit_after>#!/bin/bash

set -e

prod=false
while getopts "p" opt; do
    case $opt in
        p)
            prod=true
            ;;
    esac
done

color() {
      printf '\033[%sm%s\033[m\n' "$@"
      # usage color "31;5" "string"
      # 0 default
      # 5 blink, 1 strong, 4 underlined
      # fg: 31 red,  32 green, 33 yellow, 34 blue, 35 purple, 36 cyan, 37 white
      # bg: 40 black, 41 red, 44 blue, 45 purple
      }

color '36;1' "
      _   _       _
     | \ | |_   _| | __ _ ___
     |  \| | | | | |/ _' / __|
     | |\  | |_| | | (_| \__ \\
     |_| \_|\__, |_|\__,_|___/
            |___/

     This script installs dependencies for the Nylas Sync Engine.

     For more details, visit:
     https://www.github.com/nylas/sync-engine
"

if ! [ -e ./setup.py ] || ! [ -e ./setup.sh ] ; then
    color '31;1' "Error: setup.sh should be run from the sync-engine repo" >&2
    exit 1
fi

color '35;1' 'Updating packages...'


if command -v mysql >/dev/null 2>&1
then
    echo "MySQL Exists. Not adding upstream mysql package";
else
    echo "Adding MySQL APT Repo";
    #Trust MySQL APT Repo
    echo "deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6" > /etc/apt/sources.list.d/mysql.list;
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5072E1F5;
fi

# Don't fail builds if apt-get update fails (eg due to ksplice being down)
set +e
apt-get update
set -e

apt-get -y install python-software-properties


{ \
echo "mysql-community-server mysql-community-server/data-dir select ''"; \
echo "mysql-community-server mysql-community-server/root-pass password root"; \
echo "mysql-community-server mysql-community-server/re-root-pass password root"; \
echo "mysql-community-server mysql-community-server/remove-test-db select false"; \
echo "mysql-server mysql-server/root_password password <PASSWORD>";
echo "mysql-server mysql-server/root_password_again password root";
  } | sudo debconf-set-selections



color '35;1' 'Installing dependencies from apt-get...'
apt-get -y install git \
                   mercurial \
{'fraction_non_alphanumeric': 0.13888216791676747, 'fraction_numerical': 0.028550689571739656, 'mean_word_length': 2.4827295703454086, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 14, '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': '5667277', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1394, 'n_words': 403}