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

CHANNEL="development"

echo "Using ${CHANNEL} channel"

LATESTVERSION=$(curl -s https://s3.amazonaws.com/koding-klient/${CHANNEL}/latest-version.txt)
LATESTURL="https://s3.amazonaws.com/koding-klient/${CHANNEL}/latest/klient_0.1.${LATESTVERSION}_${CHANNEL}_amd64.deb"

echo "Downloading and installing klient 0.1.${LATESTVERSION}"
curl -s $LATESTURL -o klient.deb
sudo dpkg -i klient.deb > /dev/null

echo "Authenticate to Koding.com"
/opt/kite/klient/klient -register
<commit_msg>install: add kite_home and kontrol_url parameters<commit_after>#!/usr/bin/env bash

CHANNEL="development"

echo "Using ${CHANNEL} channel"

LATESTVERSION=$(curl -s https://s3.amazonaws.com/koding-klient/${CHANNEL}/latest-version.txt)
LATESTURL="https://s3.amazonaws.com/koding-klient/${CHANNEL}/latest/klient_0.1.${LATESTVERSION}_${CHANNEL}_amd64.deb"

echo "Downloading and installing klient 0.1.${LATESTVERSION}"
curl -s $LATESTURL -o klient.deb
sudo dpkg -i klient.deb > /dev/null

echo "Authenticate to Koding.com"
sudo -E /opt/kite/klient/klient -register -kite-home "/etc/kite"

if [ ! -f /etc/kite/kite.key ]; then
    echo "Kite.key not found. Aborting installation"
    exit -1
fi

# Production kontrol might return a different kontrol URL. Let us control this aspect.
KONTROLURL="https://koding.com/kontrol/kite"
escaped_var=$(printf '%s\n' "$KONTROLURL" | sed 's:[/&\]:\\&:g;s/$/\\/')
sudo sed -i "s/\.\/klient -kontrol-url $escaped_var \.\/klient/g/" "/etc/init/klient.conf"

# We need to restart it so it pick up the new environment variable
sudo service klient restart


{'fraction_non_alphanumeric': 0.16114928169893816, 'fraction_numerical': 0.010618363522798251, 'mean_word_length': 4.467576791808874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '3037428', 'n_tokens_mistral': 618, 'n_tokens_neox': 594, 'n_words': 132}