#! /bin/bash # file: prep G. Moody 21 December 2013 # Last revised: 21 April 2015 # Challenge 2015 evaluation, stage 1: prepare an entry for evaluation set -e # Check the environment variables. if [ ! -d "$CHALLENGE" ]; then echo "CHALLENGE not set" exit 1 fi if [ ! -f "$CHALLENGE_ROOT_IMG" ]; then echo "CHALLENGE_ROOT_IMG not set" exit 1 fi if [ ! -f "$CHALLENGE_HOME_IMG" ]; then echo "CHALLENGE_HOME_IMG not set" exit 1 fi if [ ! -f "$CHALLENGE_ENTRY" ]; then echo "CHALLENGE_ENTRY not set" exit 1 fi SE=`basename "$CHALLENGE_ENTRY"` cat >unpack.sh <>/tmp/prep/answers; then echo "Error: Result for record '\$rec' is missing" fi done | sed '11{s/.*/ .../;q}' | grep . && EX=1 fi if [ -z "$CHALLENGE_IGNORE_MISSING" ] && [ \$EX -ne 0 ]; then echo "Required component(s) missing -- not scored" exit 1 fi sed 's/\\r\$//' -i setup.sh next.sh answers.txt chmod 755 setup.sh next.sh if grep -q '^NEED_MATLAB=1' setup.sh; then touch /tmp/prep/00_matlab fi touch /tmp/prep/00_unpacked EOF cat >compile.sh </tmp/prep/setup.log 2>&1 x=\$? if [ \$x != 0 ]; then case \$x in 124) echo "Error: setup.sh timed out after 5 minutes" ;; *) echo "Error: setup.sh failed (status \$x)" ;; esac exit 1 # quit if error or timeout in setup.sh fi touch /tmp/prep/00_compiled EOF cat >licensecheck.sh <> /tmp/prep/00_warnings touch /tmp/prep/00_success EOF chmod +x unpack.sh compile.sh licensecheck.sh # (FIXME: Ubuntu locks up if we use -J 2 while limited to 2 real CPUs, why?) # Run the script generated by prep in the VM. cvmrun --rw -T 240 -c './unpack.sh >&/tmp/prep/00_log' unpack.sh \ $CHALLENGE_ENTRY $CHALLENGE/data/quiz/RECORDS \ -i /tmp/prep -o results/prep [ -f results/prep/00_unpacked ] if [ -f results/prep/00_matlab ]; then cvmrun --net --opt $CHALLENGE/matlab.img \ --rw -T 360 -c './compile.sh >&/tmp/prep/00_log' compile.sh \ $CHALLENGE/mlconf.sh -i /tmp/prep -o tainted-prep $CHALLENGE/scrub tainted-prep results/prep else cvmrun --rw -T 360 -c './compile.sh >&/tmp/prep/00_log' compile.sh \ -i /tmp/prep -o results/prep fi [ -f results/prep/00_compiled ] cvmrun -T 240 --home $CHALLENGE/home.img --opt $CHALLENGE_HOME_IMG \ -c './licensecheck.sh' licensecheck.sh `which check-entry-copyrights` \ -i /tmp/prep -o results/prep [ -f results/prep/00_success ]