<commit_before>#!/bin/bash

DISTFILES=dist/
DOCKER_COMPOSE_FILE=docker-compose.yml
DEFAULT_INSTALL_PATH=/usr/local/dig

TEMP_DIR=$(mktemp -d)
cp bootstrap.sh ${TEMP_DIR}

cat > ${TEMP_DIR}/run.sh <<EOF
#!/bin/bash
./docker-compose up
EOF
chmod +x ${TEMP_DIR}/bootstrap.sh
chmod +x ${TEMP_DIR}/run.sh
cp -r dist/ ${TEMP_DIR}
cp -r conf/ ${TEMP_DIR}
cp docker-compose.yml ${TEMP_DIR}

makeself --notemp ${TEMP_DIR} dig_deploy.sh "Deployment package for DIG" ./bootstrap.sh

while getopts ":k" opt; do
    case $opt in
	k)
	    echo "Not removing temporary directory: ${TEMP_DIR}"
	    unset RMDIR
	    ;;
	\?)
	    echo "INVALID OPTION: -$OPTARG" >&2
	    ;;
    esac
done
[[ $RMDIR ]] && rm -rf ${TEMP_DIR}
exit 0<commit_msg>Package script now asks for location of conf dir<commit_after>#!/bin/bash

DISTFILES=dist/
DOCKER_COMPOSE_FILE=docker-compose.yml
DEFAULT_INSTALL_PATH=/usr/local/dig
DEFAULT_CFGDIR=./conf
RMDIR=1
TEMP_DIR=$(mktemp -d)

cleanup() {
    [[ $RMDIR ]] && rm -rf ${TEMP_DIR}
    exit 0
}

get_options() {
    while getopts ":k" opt; do
	case $opt in
	    k)
		echo "Not removing temporary directory: ${TEMP_DIR}"
		unset RMDIR
		;;
	    \?)
		echo "INVALID OPTION: -$OPTARG" >&2
		;;
	esac
    done
    # Locate conf dir
    read -p "Location of config dir? [$DEFAULT_CFGDIR] " dirloc
    CFGDIR=${dirloc:-$DEFAULT_CFGDIR}    
}

copy_files() {
    cp bootstrap.sh ${TEMP_DIR}
    cat > ${TEMP_DIR}/run.sh <<EOF
#!/bin/bash
./docker-compose up
EOF
    chmod +x ${TEMP_DIR}/bootstrap.sh
    chmod +x ${TEMP_DIR}/run.sh
    cp -r dist/ ${TEMP_DIR}
    if [[ ! -d "${CFGDIR}" ]]; then
	echo "Could not find config dir!"
	exit 1
    else
	echo "Found config dir, copying"
    fi
    cp -r ${CFGDIR} ${TEMP_DIR}
    cp docker-compose.yml ${TEMP_DIR}
}

create_package() {
    makeself --notemp ${TEMP_DIR} dig_deploy.sh "Deployment package for DIG" ./bootstrap.sh
}




get_options
copy_files
create_package
cleanup
{'fraction_non_alphanumeric': 0.14774494556765164, 'fraction_numerical': 0.003110419906687403, 'mean_word_length': 3.337078651685393, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '2909803', 'n_tokens_mistral': 786, 'n_tokens_neox': 755, 'n_words': 192}