diff options
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/boca-submit-run | 13 | ||||
| -rwxr-xr-x | tools/boca-submit-run-cron | 18 | ||||
| -rwxr-xr-x | tools/boca-submit-run-root | 19 | ||||
| -rwxr-xr-x | tools/etc/icpc/installboca.sh | 8 | ||||
| -rwxr-xr-x | tools/genpackage.sh | 2 |
5 files changed, 50 insertions, 10 deletions
diff --git a/tools/boca-submit-run b/tools/boca-submit-run index 87daeb8..0b42e9f 100755 --- a/tools/boca-submit-run +++ b/tools/boca-submit-run @@ -36,6 +36,15 @@ if [ "$1" == "" ]; then exit 1 fi +runaux=`which boca-submit-run-aux` +if [ "$runaux" == "" ]; then + runaux=/var/www/boca/tools/boca-submit-run-aux +fi +runroot=`which boca-submit-run-root` +if [ "$runroot" == "" ]; then + runroot=/var/www/boca/tools/boca-submit-run-root +fi + if [ -r "$5" ]; then nom=`echo -n "$5" | perl -MURI::Escape -lne 'print uri_escape($_)'` for BOCASERVER in `echo $BOCASERVERS | cut -d';'`; do @@ -47,10 +56,10 @@ if [ -r "$5" ]; then echo -n "data=" >> $temp uuencode -m zzzzzzzzzz < "$5" | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> $temp echo "" >> $temp - boca-submit-run-aux $temp + $runaux $temp if [ "$?" == "2" ]; then echo "$BOCASERVER: time-out - this will automatically retry soon, you should not worry" - boca-submit-run-root $temp + $runroot "$BOCASERVER" "$user" "$pass" "$nom" "$5" fi rm $temp done diff --git a/tools/boca-submit-run-cron b/tools/boca-submit-run-cron index c77b4d5..ace21d0 100755 --- a/tools/boca-submit-run-cron +++ b/tools/boca-submit-run-cron @@ -1,5 +1,17 @@ #!/bin/bash -for i in `ls /root/submissions/*.bocarun`; do - boca-submit-run-aux "$i" -done +if [ "`id -u`" != "0" ]; then + echo "Must be run as root" + exit 1 +fi + +if [ -d /root/submissions ]; then + runaux=`which boca-submit-run-aux` + if [ "$runaux" == "" ]; then + runaux=/var/www/boca/tools/boca-submit-run-aux + fi + + for i in `ls /root/submissions/*.bocarun`; do + $runaux "$i" + done +fi diff --git a/tools/boca-submit-run-root b/tools/boca-submit-run-root index 21ecbc6..60365cf 100755 --- a/tools/boca-submit-run-root +++ b/tools/boca-submit-run-root @@ -1,11 +1,23 @@ #!/bin/bash -if [ "$1" != "" ]; then +if [ "`id -u`" != "0" ]; then + echo "Must be run as root" + exit 1 +fi + +if [ "$5" != "" ]; then mkdir -p /root/submissions chown root /root/submissions chmod 700 /root/submissions - nom=/root/submissions/`date +%s%N`.bocarun - cp "$1" "$nom" + nom=/root/submissions/`date +%s%N`.bocarun.tmp + + echo "BOCASERVER=`echo "$1" | tr -cd '[[:alnum:]]._-'`" > "$nom" + echo "user=`echo "$2" | tr -cd '[[:alnum:]]._-'`" >> "$nom" + echo "pass=`echo "$3" | tr -cd '[[:alnum:]]._-'`" >> "$nom" + echo "name=`echo "$4" | tr -cd '[[:alnum:]]._-'`" >> "$nom" + echo -n "data=" >> "$nom" + uuencode -m zzzzzzzzzz < `echo "$5" | tr -cd '[[:alnum:]]._-'` | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> "$nom" + echo "" >> "$nom" echo "dateerr=`date +%s`" >> "$nom" uniq=`date +%sN`-`sha256sum "$1"` uniq=`echo $uniq | sha256sum - | cut -f1 -d' '` @@ -13,4 +25,5 @@ if [ "$1" != "" ]; then res=`echo -n "${code}${uniq}${dateerr}" | sha256sum - | cut -f1 -d' '` echo "uniq=$uniq" >> "$nom" echo "code=$res" >> "$nom" + mv "$nom" "/root/submissions/`basename $nom .tmp`" fi diff --git a/tools/etc/icpc/installboca.sh b/tools/etc/icpc/installboca.sh index bea085c..28eb0c7 100755 --- a/tools/etc/icpc/installboca.sh +++ b/tools/etc/icpc/installboca.sh @@ -131,6 +131,12 @@ if [ "$OK" == "y" ]; then cp -f $conffile boca-$bocaver/src/private/conf.php fi chmod 700 boca-$bocaver/tools/*.sh +chmod 755 boca-$bocaver/tools/boca-submit-run* +chmod 700 boca-$bocaver/tools/boca-submit-run-cron + +chown root.root boca-$bocaver/tools/boca-submit-run-root +chmod 4555 boca-$bocaver/tools/boca-submit-run-root +echo "*/2 * * * * * root `pwd`/boca-$bocaver/tools/boca-submit-run-cron" > /etc/cron.d/boca cat > boca-$bocaver/src/.htaccess <<EOF php_flag output_buffering on @@ -214,4 +220,4 @@ cat > /etc/apache2/conf.d/boca <<EOF Alias /boca $basedir/boca/src EOF -ln -s /etc/apache2/conf.d/boca /etc/apache2/conf-enabled/boca.conf +ln -s /etc/apache2/conf.d/boca /etc/apache2/conf-enabled/boca.conf 2>/dev/null diff --git a/tools/genpackage.sh b/tools/genpackage.sh index 4830675..dd4932f 100755 --- a/tools/genpackage.sh +++ b/tools/genpackage.sh @@ -54,7 +54,7 @@ rm boca-$ver/.temp `find boca-$ver/ -name "._*"` cd boca-$ver/tools/etc tar czf ../icpc.etc.tgz * cd ../../.. -tar czf $cdir/boca-$ver.tgz boca-$ver/ +COPYFILE_DISABLE=1 tar czf $cdir/boca-$ver.tgz boca-$ver/ rm -rf /tmp/boca-$ver echo "*** file generated: $cdir/boca-$ver.tgz" else |