<commit_before>#!/bin/bash
#
# Install minimum prerequisites (including git)
# download ub_tools (via git)
# compile cpp installer
# run it

# check prerequisites and invariants
if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi
if [[ ! $PATH =~ "/usr/local/bin" ]]; then
    echo "Please add /usr/local/bin to your PATH before starting the installation!"
    exit 1
fi

echo "Branch is: ${BRANCH}"

echo "Installing dependencies..."
exit 1

cd /tmp
if [ ! -e ./install_ubuntu_packages.sh ]; then
    apt-get --quiet --yes update
    apt-get --yes install curl
    curl https://raw.githubusercontent.com/ubtue/ub_tools/master/cpp/data/installer/scripts/install_ubuntu_packages.sh -o ./install_ubuntu_packages.sh
    chmod 700 ./install_ubuntu_packages.sh
fi
./install_ubuntu_packages.sh

if [ -d /usr/local/ub_tools ]; then
    echo "ub_tools already exists, skipping download"
else
    echo "cloning ub_tools"
    git clone https://github.com/ubtue/ub_tools.git /usr/local/ub_tools
fi

echo "building prerequisites"
cd /usr/local/ub_tools/cpp/lib/mkdep && CCC=clang++ make --jobs=4 install

echo "building cpp installer"
cd /usr/local/ub_tools/cpp && CCC=clang++ make --jobs=4 installer

echo "starting cpp installer"
/usr/local/ub_tools/cpp/installer $*<commit_msg>intermediate change<commit_after>#!/bin/bash
#
# Install minimum prerequisites (including git)
# download ub_tools (via git)
# compile cpp installer
# run it

# check prerequisites and invariants
if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi
if [[ ! $PATH =~ "/usr/local/bin" ]]; then
    echo "Please add /usr/local/bin to your PATH before starting the installation!"
    exit 1
fi

echo "Branch is: ${BRANCH}"

echo "Installing dependencies..."

cd /tmp
if [ ! -e ./install_ubuntu_packages.sh ]; then
    apt-get --quiet --yes update
    apt-get --yes install curl
    curl https://raw.githubusercontent.com/ubtue/ub_tools/master/cpp/data/installer/scripts/install_ubuntu_packages.sh -o ./install_ubuntu_packages.sh
    chmod 700 ./install_ubuntu_packages.sh
fi
./install_ubuntu_packages.sh

if [ -d /usr/local/ub_tools ]; then
    echo "ub_tools already exists, skipping download"
else
    echo "cloning ub_tools"
    git clone --branch ${BRANCH} https://github.com/ubtue/ub_tools.git /usr/local/ub_tools
fi

echo "building prerequisites"
cd /usr/local/ub_tools/cpp/lib/mkdep && CCC=clang++ make --jobs=4 install

echo "building cpp installer"
cd /usr/local/ub_tools/cpp && CCC=clang++ make --jobs=4 installer

echo "starting cpp installer"
/usr/local/ub_tools/cpp/installer $*
{'fraction_non_alphanumeric': 0.1286039453717754, 'fraction_numerical': 0.007966616084977238, 'mean_word_length': 3.6590106007067136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '815793', 'n_tokens_mistral': 952, 'n_tokens_neox': 874, 'n_words': 259}