#! /bin/bash

# file: setup.sh

# This bash script performs any setup necessary in order to test your entry.
# It is run only once, before running any other code belonging to your entry.

# Install the WFDB Toolbox for MATLAB and Octave
unzip sources/wfdb-app-toolbox-*.zip

# Configure the toolbox to use the custom native library built on Debian Wheezy
sed -i 's/WFDB_CUSTOMLIB=0;/WFDB_CUSTOMLIB=1;/' ./mcode/wfdbloadlib.m

OCTAVE='octave --quiet --eval '
STR="${OCTAVE} \"cd('mcode');addpath(pwd);savepath;quit;\""
echo "$STR"
eval ${STR}

OCTAVE='octave --quiet --eval '
STR="${OCTAVE} \"cd('sources');addpath(pwd);savepath;quit;\""
echo "$STR"
eval ${STR}

stty sane
