<commit_before>#!/bin/bash
#
REVISION="v1.4.2"

function assertUsername {
    USERNAME=$1
    ERROR_MSG=$2
    WHOAMI=$(whoami)

    if [ "$USERNAME" = "" ];then
        echo "SCRIPTING error, assertUsername expects a username to be supplied to check."
        exit 1
    fi

    if [ "$WHOAMI" != "$USERNAME" ]; then
        echo "This script should be run as the $USERNAME user."
        if [ "$ERROR_MSG" != "" ]; then
            echo $ERROR_MSG;
        fi
        exit 1
    fi
}

function setupUsers() {
    sudo adduser --system archivesspace
    sudo addgroup archivesspace
    sudo adduser archivesspace archivesspace
    sudo adduser vagrant archivesspace
    echo "Groups archivesspace"
    groups archivesspace
    echo "Gourps vagrant"
    groups vagrant
}

#
# Setup MySQL appropriately
#
function setupMySQL {
    echo "Setup MySQL? [Y/n]"
    read Y_OR_N

    if [ "$Y_OR_N" = "" ] || [ "$Y_OR_N" = "y" ] || [ "$Y_OR_N" = "Y" ]; then
        cd /vagrant/
        echo "Working directory now $(pwd)"
        echo "Setting up MySQL users and creating database"
        touch archivesspace-mysql-setup.sql
        cat <<EOT >> archivesspace-mysql-setup.sql
CREATE DATABASE archivesspace DEFAULT CHARACTER SET utf8;
GRANT ALL ON archivesspace.* TO 'as'@'localhost' IDENTIFIED BY 'as123';
FLUSH PRIVILEGES;
EOT<commit_msg>draft<commit_after>#!/bin/bash
#
REVISION="v1.4.2"

function assertUsername {
    USERNAME=$1
    ERROR_MSG=$2
    WHOAMI=$(whoami)

    if [ "$USERNAME" = "" ];then
        echo "SCRIPTING error, assertUsername expects a username to be supplied to check."
        exit 1
    fi

    if [ "$WHOAMI" != "$USERNAME" ]; then
        echo "This script should be run as the $USERNAME user."
        if [ "$ERROR_MSG" != "" ]; then
            echo $ERROR_MSG;
        fi
        exit 1
    fi
}

function setupUsers() {
    sudo adduser --system archivesspace
    sudo addgroup archivesspace
    sudo adduser archivesspace archivesspace
    sudo adduser vagrant archivesspace
    echo "Groups archivesspace"
    groups archivesspace
    echo "Gourps vagrant"
    groups vagrant
}

#
# Setup MySQL appropriately
#
function setupMySQL {
    echo "Setup MySQL? [Y/n]"
    read Y_OR_N

    if [ "$Y_OR_N" = "" ] || [ "$Y_OR_N" = "y" ] || [ "$Y_OR_N" = "Y" ]; then
        cd /vagrant/
        echo "Working directory now $(pwd)"
        echo "Setting up MySQL users and creating database"
        touch archivesspace-mysql-setup.sql
        cat <<EOT >> archivesspace-mysql-setup.sql
CREATE DATABASE IF NOT EXIST archivesspace DEFAULT CHARACTER SET utf8;
GRANT ALL ON archivesspace.* TO 'as'@'localhost' IDENTIFIED BY '<PASSWORD>';
FLUSH PRIVILEGES;
EOT
{'fraction_non_alphanumeric': 0.1075429424943988, 'fraction_numerical': 0.007094846900672144, 'mean_word_length': 2.710526315789474, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4220264', 'n_tokens_mistral': 933, 'n_tokens_neox': 884, 'n_words': 266}