<commit_before>#!/bin/bash

EIRODS_HOME_DIR=$1
OS_EIRODS_ACCT=$2
SERVER_TYPE=$3
DB_TYPE=$4
DB_ADMIN_ROLE=$5
DB_NAME=$6
DB_HOST=$7
DB_PORT=$8
DB_USER=$9
DB_PASS=$10

IRODS_HOME=$EIRODS_HOME_DIR/iRODS

# =-=-=-=-=-=-=-
# clean up any stray iRODS files in /tmp which will cause problems
if [ -f /tmp/irodsServer.* ]; then
  rm /tmp/irodsServer.*
fi

if [ "$SERVER_TYPE" == "icat" ] ; then

  if [ "$DB_TYPE" == "postgres" ] ; then
    # =-=-=-=-=-=-=-
    # detect database path and update installed irods.config accordingly
    PSQL=`$EIRODS_HOME_DIR/packaging/find_postgres.sh`
    EIRODSPOSTGRESPATH=`$PSQL | sed -e s,\/[^\/]*$,, -e s,\/[^\/]*$,,`
    EIRODSPOSTGRESPATH="$EIRODSPOSTGRESPATH/"
    echo "Detecting PostgreSQL Path: [$EIRODSPOSTGRESPATH]"
    sed -e ,^\$DATABASE_HOME,s,^.*$,"\$DATABASE_HOME = '$EIRODSPOSTGRESPATH';", $IRODS_HOME/config/irods.config > /tmp/irods.config.tmp
    mv /tmp/irods.config.tmp $IRODS_HOME/config/irods.config

    # =-=-=-=-=-=-=-
    # determine if the database role already exists
    ROLE=$( su --shell=/bin/bash --session-command="$PSQL $DB_ADMIN_ROLE -tAc \"SELECT 1 FROM pg_roles WHERE rolname='$DB_USER'\"" $DB_ADMIN_ROLE )
    if [ $ROLE ]; then
      echo "WARNING :: Role $DB_USER Already Exists in Database."
    else
      # =-=-=-=-=-=-=-<commit_msg>escape the first comma, so older sed can run on centos 5.7 (sed 4.1.5)<commit_after>#!/bin/bash

EIRODS_HOME_DIR=$1
OS_EIRODS_ACCT=$2
SERVER_TYPE=$3
DB_TYPE=$4
DB_ADMIN_ROLE=$5
DB_NAME=$6
DB_HOST=$7
DB_PORT=$8
DB_USER=$9
DB_PASS=$10

IRODS_HOME=$EIRODS_HOME_DIR/iRODS

# =-=-=-=-=-=-=-
# clean up any stray iRODS files in /tmp which will cause problems
if [ -f /tmp/irodsServer.* ]; then
  rm /tmp/irodsServer.*
fi

if [ "$SERVER_TYPE" == "icat" ] ; then

  if [ "$DB_TYPE" == "postgres" ] ; then
    # =-=-=-=-=-=-=-
    # detect database path and update installed irods.config accordingly
    PSQL=`$EIRODS_HOME_DIR/packaging/find_postgres.sh`
    EIRODSPOSTGRESPATH=`$PSQL | sed -e s,\/[^\/]*$,, -e s,\/[^\/]*$,,`
    EIRODSPOSTGRESPATH="$EIRODSPOSTGRESPATH/"
    echo "Detecting PostgreSQL Path: [$EIRODSPOSTGRESPATH]"
    sed -e "\,^\$DATABASE_HOME,s,^.*$,\$DATABASE_HOME = '$EIRODSPOSTGRESPATH';," $IRODS_HOME/config/irods.config > /tmp/irods.config.tmp
    mv /tmp/irods.config.tmp $IRODS_HOME/config/irods.config

    # =-=-=-=-=-=-=-
    # determine if the database role already exists
    ROLE=$( su --shell=/bin/bash --session-command="$PSQL $DB_ADMIN_ROLE -tAc \"SELECT 1 FROM pg_roles WHERE rolname='$DB_USER'\"" $DB_ADMIN_ROLE )
    if [ $ROLE ]; then
      echo "WARNING :: Role $DB_USER Already Exists in Database."
    else
      # =-=-=-=-=-=-=-
{'fraction_non_alphanumeric': 0.19152923538230884, 'fraction_numerical': 0.010869565217391304, 'mean_word_length': 3.5391156462585034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6240565', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1065, 'n_words': 215}