<commit_before>#!/bin/bash
###########################################################################
# a2o Essential Puppet Modules                                            #
#-------------------------------------------------------------------------#
# Copyright (c) <NAME>                                            #
#-------------------------------------------------------------------------#
# This source file is subject to version 2.0 of the Apache License,       #
# that is bundled with this package in the file LICENSE, and is           #
# available through the world-wide-web at the following url:              #
# http://www.apache.org/licenses/LICENSE-2.0                              #
#-------------------------------------------------------------------------#
# Authors: <NAME> <my_name [at] a2o {dot} si>                     #
###########################################################################



# Compile directory
export SRCROOT="<%= compileDir %>" &&
mkdir -p $SRCROOT &&
cd $SRCROOT &&



### Set versions and directories
export PDESTDIR="<%= destDir_mysql %>" &&



# Install database if necessary
if [ ! -d /var/mysql/data/mysql ]; then
    $PDESTDIR/bin/mysql_install_db --basedir=$PDESTDIR --datadir=/var/mysql/data &&

    /etc/rc.d/rc.mysqld start &&

    echo "DELETE FROM db"                                                                 | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&
    echo "DELETE FROM user WHERE User = ''"                                               | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&
    echo "DELETE FROM user WHERE (Host != '127.0.0.1') AND (Host != 'localhost')"         | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&
    echo "UPDATE user SET Password='<%= mysql_root_password_hash %>' WHERE Password = ''" | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&

    $PDESTDIR/bin/mysql_fix_privilege_tables
fi<commit_msg>MySQL install DB: fixed installation for mysql 5.5<commit_after>#!/bin/bash
###########################################################################
# a2o Essential Puppet Modules                                            #
#-------------------------------------------------------------------------#
# Copyright (c) <NAME>                                            #
#-------------------------------------------------------------------------#
# This source file is subject to version 2.0 of the Apache License,       #
# that is bundled with this package in the file LICENSE, and is           #
# available through the world-wide-web at the following url:              #
# http://www.apache.org/licenses/LICENSE-2.0                              #
#-------------------------------------------------------------------------#
# Authors: <NAME> <my_name [at] a2o {dot} si>                     #
###########################################################################



# Compile directory
export SRCROOT="<%= compileDir %>" &&
mkdir -p $SRCROOT &&
cd $SRCROOT &&



### Set versions and directories
export PDESTDIR="<%= destDir_mysql %>" &&



# Install database if necessary
if [ ! -d /var/mysql/data/mysql ]; then
    if [ -e $PDESTDIR/scripts/mysql_install_db ]; then
	MYSQL_INSTALL_DB="$PDESTDIR/scripts/mysql_install_db"
    elif [ -e $PDESTDIR/bin/mysql_install_db ]; then
	MYSQL_INSTALL_DB="$PDESTDIR/bin/mysql_install_db"
    else
	echo "ERROR: mysql_install_db not found"
	exit 1
    fi
    $MYSQL_INSTALL_DB --basedir=$PDESTDIR --datadir=/var/mysql/data &&

    ### Start without access checking, but disable networking for this occasion
    /bin/bash /etc/rc.d/rc.mysqld start --skip-grant-tables --skip-networking &&

    ### Fix permissions and run upgrade - just in case
    echo "DELETE FROM db"                                                                 | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&
    echo "DELETE FROM user WHERE User = ''"                                               | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&
    echo "DELETE FROM user WHERE (Host != '127.0.0.1') AND (Host != 'localhost')"         | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&
    echo "UPDATE user SET Password='<%= mysql_root_password_hash %>' WHERE Password = ''" | $PDESTDIR/bin/mysql --user=root --password= --database=mysql &&
    $PDESTDIR/bin/mysql_upgrade &&

    ### Restart with permission system enabled
    /bin/bash /etc/rc.d/rc.mysqld restart
fi
{'fraction_non_alphanumeric': 0.2726870296591412, 'fraction_numerical': 0.00597609561752988, 'mean_word_length': 1.6723832052040213, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2560148', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1118, 'n_words': 302}