]> mj.ucw.cz Git - eval.git/blob - mop/public/status.sh
Merge branch 'container'
[eval.git] / mop / public / status.sh
1 #!/bin/bash
2 # The Evaluator -- Public Status Script
3 # (c) 2004 Martin Mares <mj@ucw.cz>
4
5 set -e
6 [ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
7 pushd $MO_ROOT >/dev/null
8 . lib/libeval.sh
9 . cf/mop
10 popd >/dev/null
11
12 [ -z "$1" ] || die "Usage: status"
13
14 echo -e "Submitted tasks:\n"
15
16 if [ -n "$REMOTE_SUBMIT" ] ; then
17         exec $MO_ROOT/bin/remote-status
18 fi
19
20 for PROBLEM in `cd $MO_ROOT/problems/ ; echo *` ; do
21         (
22         PDIR=$MO_ROOT/problems/$PROBLEM
23         SUBDIR=~/.submit/$PROBLEM
24         [ -f $PDIR/config ] || exit 0
25         echo -n "$PROBLEM: "
26         . $PDIR/config
27         if [ -d $SUBDIR ] ; then
28                 if [ $TASK_TYPE == open-data ] ; then
29                         for X in $TESTS ; do
30                                 [ -f $SUBDIR/$X.out ] && echo -n "$X " || echo -n "- "
31                         done
32                         echo
33                 else
34                         C=0
35                         for X in $EXTENSIONS ; do
36                                 if [ -f $SUBDIR/$PROBLEM.$X ] ; then
37                                         echo -n `basename $SUBDIR/$PROBLEM.$X`
38                                         C=$(($C+1))
39                                 fi
40                         done
41                         if [ $C == 0 ] ; then
42                                 echo ---
43                         elif [ $C == 1 ] ; then
44                                 echo
45                         else
46                                 echo "INCONSISTENT (you probably modified $SUBDIR manually)"
47                         fi
48                 fi
49         else
50                 echo ---
51         fi
52         )
53 done