<commit_before>#!/bin/sh

DIR=$(${STACK_EXE:-stack} path --local-install-root)
TARGET_DIR=$(mktemp -d)
# Copy dynlibs into target dir, but avoid sensitive "system" ones, for
# which we shouldn't override whatever version is already installed on
# the remote system.
for i in $(ldd $DIR/bin/$1 | egrep -v '(libc|libpthread)' | awk '{print $3}')
do
    cp $i $TARGET_DIR
done
cp $DIR/bin/$1 $TARGET_DIR/hsapp
(cd $TARGET_DIR; ls $TARGET_DIR; zip app *)
[ -d $2 ] || mkdir $2 # make sure src/main/resources exists
install $TARGET_DIR/app.zip $2/app.zip
rm -rf $TARGET_DIR<commit_msg>Bail on error and check usage in copy-exe.sh.<commit_after>#!/bin/sh

set -e

if [ "$#" -ne 2 ]
then
    echo "Usage: copy-exe.sh <executable> <target-directory>"
    exit 1
fi

DIR=$(${STACK_EXE:-stack} path --local-install-root)
TARGET_DIR=$(mktemp -d)
# Copy dynlibs into target dir, but avoid sensitive "system" ones, for
# which we shouldn't override whatever version is already installed on
# the remote system.
for i in $(ldd $DIR/bin/$1 | egrep -v '(libc|libpthread)' | awk '{print $3}')
do
    cp $i $TARGET_DIR
done
cp $DIR/bin/$1 $TARGET_DIR/hsapp
(cd $TARGET_DIR; zip app *)
install -D $TARGET_DIR/app.zip $2/app.zip
rm -rf $TARGET_DIR
{'fraction_non_alphanumeric': 0.14995925020374898, 'fraction_numerical': 0.009779951100244499, 'mean_word_length': 4.116666666666666, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7206466', 'n_tokens_mistral': 459, 'n_tokens_neox': 443, 'n_words': 149}