blob: ab1cd571c3d34a9ca7d99d8a715e780e9ca42b50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#!/bin/bash
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
if [[ ! -e /etc/bocaip ]] ; then
echo "O IP do servidor boca nao configurado. Abort."
exit 1
fi
#Check if this script is running in a user in sudo group or root
if groups | egrep -q "(sudo|root)" ; then
echo "Este script deve ser executado por um usuario normal"
echo "Na Maratona este usuario, geralmente, eh o 'icpc'"
exit 1
fi
runroot=`which boca-submit-run-root-wrapper`
if [ "$runroot" == "" ]; then
runroot=/usr/bin/boca-submit-run-root-wrapper
fi
if [ "`basename $0`" == "boca-submit-oldlist" ]; then
$runroot list old list list list list list
else
if [ "`basename $0`" == "boca-submit-list" ]; then
$runroot list list list list list list list
else
source /etc/bocaip
BOCASERVER=$BOCAIP
if [ "$BOCASERVER" != "" ]; then
if [ "$BOCASERVERS" == "" ]; then
BOCASERVERS=$BOCASERVER
else
BOCASERVERS="$BOCASERVERS;$BOCASERVER"
fi
fi
if [ "$BOCASERVERS" == "" ]; then
echo "This computer has no configured BOCA server. Ask an admin to update /etc/icpc/bocaserver.sh (usually resetting everything is an easy way)"
exit 1
fi
for i in uuencode wget tr perl sha256sum cut; do
p=`which $i`
if [ -x "$p" ]; then
echo -n ""
else
echo "$i" not found
exit 1
fi
done
if [ "$1" == "" ]; then
echo "Usage: $0 USER PASSWORD PROBLEM LANGUAGE FILE"
echo ""
echo "where USER is your username"
echo "PASSWORD is your password"
echo "FILE is your submission file"
echo "PROBLEM and LANGUAGE are according to defined in BOCA"
echo "==>>You can check at your BOCA interface to be sure<<=="
echo "PROBLEM is usually a single letter e.g. A or B or C etc"
echo "LANGUAGE is usually one of { c cpp cc java }"
echo "==>>You can check at your BOCA interface to be sure<<=="
exit 1
fi
if [ -r "$5" ]; then
if [ "$4" != "C" -a "$4" != "C++11" -a "$4" != "Java" -a "$4" != "Python2" -a "$4" != "Python3" ]; then
echo "Warning: language name is not standard, be sure it is correct (this is not necessarily an error)"
fi
nom=`echo -n "$5" | perl -MURI::Escape -lne 'print uri_escape($_)'`
if [ "$nom" != "$5" ]; then
echo "Invalid file name"
exit 1
fi
for BOCASERVER in `echo $BOCASERVERS | tr ';' ' '`; do
$runroot "$BOCASERVER" "$1" "$2" "$3" "$4" "`basename $nom`" "$nom"
done
else
echo "file $5 not found/readable"
fi
fi
fi
|