#!/usr/bin/bash
# Runs an arbitrary script
###SHELLPACK preamble script-bench 1
###SHELLPACK parseargBegin
###SHELLPACK parseargInstall
###SHELLPACK parseargEnd
###SHELLPACK monitor_hooks

cd $SHELLPACK_TOP
wget -O script.sh $SCRIPT_LOCATION || die "Failed to download $SCRIPT_LOCATION"
chmod a+x script.sh
./script.sh 2>&1 | tee $LOGDIR_RESULTS/script.log
gzip $LOGDIR_RESULTS/script.log

if [ "$SCRIPT_KEEP" != "" ]; then
	tar -czf $LOGDIR_RESULTS/script-data.tar.gz $SCRIPT_KEEP
fi

exit $SHELLPACK_SUCCESS
