<commit_before>#!/bin/bash
#
# $Id: $
#
# Copy files from source directory to target directory, ignoring those listed as
# blacklisted, and replace the originals with a symlink to the copy.
#
# This is used to create a test  working copy of an ADMIRAL system, with
# supplied host name, password and group leader names interpolated into key 
# configuration files (???)
#
# Copyright (c) 2010 University of Oxford
# MIT Licensed - see LICENCE.txt or http://www.opensource.org/licenses/mit-license.php
#

USAGE="$0 (test|copy) hostname password [targetdir]"

if [[ "$1" != "test" && "$1" != "copy" ]]; then
    echo "Usage: $USAGE"
    exit 2
fi

if [[ "$2" == "" || "$3" == "" ]]; then
    echo "Usage: $USAGE"
    exit 2
fi

# Host-specific parameters
COPYTEST=$1
HOSTNAME=$2
PASSWORD=$3
source $HOSTNAME/hostconfig.sh

# Common configuration code
SRCDIR="."
TGTROOTS="/var/kvm /mnt/data/tool"
for TR in $TGTROOTS; do
    if [[ -e $TR ]]; then
        TGTDIR="$TR/$HOSTNAME"
    fi
done
if [[ "$4" != "" ]]; then
    TGTDIR="$4"
fi
echo "TGTDIR: $TGTDIR"
mkdir -p $TGTDIR

BLACKLISTPATTERN="^(.*~|.*\\.(tmp|bak)|a1\.sh|copywithhostandpassword\.sh)$"
FILELIST="`ls -1 --directory --ignore-backups --file-type * ldapconfig/* www/* www/*/* $HOSTNAME/* $HOSTNAME/*/*`"
REPORT="echo"
REPORT=":"
MD5PASSWD=`<PASSWORD> -h {MD5} -s $PASSWORD`

if [[ "$IPADDR" == "" ]]; then
    IP=`host $HOSTNAME | cut -d ' ' -f4`
else
    IP=$IPADDR
fi<commit_msg>Make test mode output more sane<commit_after>#!/bin/bash
#
# $Id: $
#
# Copy files from source directory to target directory, ignoring those listed as
# blacklisted, and replace the originals with a symlink to the copy.
#
# This is used to create a test  working copy of an ADMIRAL system, with
# supplied host name, password and group leader names interpolated into key 
# configuration files (???)
#
# Copyright (c) 2010 University of Oxford
# MIT Licensed - see LICENCE.txt or http://www.opensource.org/licenses/mit-license.php
#

USAGE="$0 (test|copy) hostname password [targetdir]"

if [[ "$1" != "test" && "$1" != "copy" ]]; then
    echo "Usage: $USAGE"
    exit 2
fi

if [[ "$2" == "" || "$3" == "" ]]; then
    echo "Usage: $USAGE"
    exit 2
fi

# Host-specific parameters
COPYTEST=$1
HOSTNAME=$2
PASSWORD=$3
source $HOSTNAME/hostconfig.sh

# Common configuration code
SRCDIR="."
TGTROOTS="/var/kvm /mnt/data/tool"
for TR in $TGTROOTS; do
    if [[ -e $TR ]]; then
        TGTDIR="$TR/$HOSTNAME"
    fi
done
if [[ "$4" != "" ]]; then
    TGTDIR="$4"
fi
echo "TGTDIR: $TGTDIR"
mkdir -p $TGTDIR

BLACKLISTPATTERN="^(.*~|.*\\.(tmp|bak)|a1\.sh|copywithhostandpassword\.sh)$"
FILELIST="`ls -1 --directory --ignore-backups --file-type * ldapconfig/* www/* www/*/* $HOSTNAME/* $HOSTNAME/*/*`"
REPORT="echo"
REPORT=":"
MD5PASSWD=`slappasswd -h {MD5} -s $PASSWORD`

if [[ "$IPADDR" == "" ]]; then
    IP=`host $HOSTNAME | cut -d ' ' -f4`
else
    IP=$IPADDR
fi

echo "Substitutions:"
echo "  s/%{HOSTNAME}/$HOSTNAME/g"
echo "  s/%{PASSWORD}/$PASSWORD/g"
echo "  s/%{WORKGROUP}/$WORKGROUP/g"
echo "  s/%{IPADDR}/$IP/g"
echo "  s/%{LeaderName}/$LEADERNAME/g"
echo "  s!%{MD5PASS}!$MD5PASSWD!g"
echo "  s/%{DATABANKHOST}/$DATABANKHOST/g"
echo "  s/%{DATABANKSILO}/$DATABANKSILO/g"
echo ""
{'fraction_non_alphanumeric': 0.18550634871477237, 'fraction_numerical': 0.01362650975534221, 'mean_word_length': 3.7781065088757395, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '959824', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1217, 'n_words': 335}