From b3dcfc7cfa76a09bcd6cdfddaf7897b88b98aa20 Mon Sep 17 00:00:00 2001 From: cassiopc Date: Mon, 6 Aug 2012 11:38:44 +0200 Subject: include file /etc/boca.conf with info where is boca installed --- boca-1.5.0/tools/autojudge.sh | 25 +++++++++++- boca-1.5.0/tools/etc/icpc/installboca.sh | 65 ++++++++++++++++++++++++-------- boca-1.5.0/tools/genpackage.sh | 17 +++++++++ boca-1.5.0/tools/installv2.sh | 6 +-- 4 files changed, 93 insertions(+), 20 deletions(-) diff --git a/boca-1.5.0/tools/autojudge.sh b/boca-1.5.0/tools/autojudge.sh index d0e097b..799c257 100755 --- a/boca-1.5.0/tools/autojudge.sh +++ b/boca-1.5.0/tools/autojudge.sh @@ -1,3 +1,26 @@ #!/bin/bash -cd /var/www/boca +# //////////////////////////////////////////////////////////////////////////////// +# //BOCA Online Contest Administrator +# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) +# // +# // This program is free software: you can redistribute it and/or modify +# // it under the terms of the GNU General Public License as published by +# // the Free Software Foundation, either version 3 of the License, or +# // (at your option) any later version. +# // +# // This program is distributed in the hope that it will be useful, +# // but WITHOUT ANY WARRANTY; without even the implied warranty of +# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# // GNU General Public License for more details. +# // You should have received a copy of the GNU General Public License +# // along with this program. If not, see . +# //////////////////////////////////////////////////////////////////////////////// +# // Last modified 06/aug/2012 by cassio@ime.usp.br +if [ "`id -u`" != "0" ]; then + echo "Must be run as root" + exit 1 +fi +bocadir=/var/www/boca +[ -r /etc/boca.conf ] && . /etc/boca.conf +cd $bocadir php private/autojudging.php diff --git a/boca-1.5.0/tools/etc/icpc/installboca.sh b/boca-1.5.0/tools/etc/icpc/installboca.sh index 3f91729..13b8f43 100644 --- a/boca-1.5.0/tools/etc/icpc/installboca.sh +++ b/boca-1.5.0/tools/etc/icpc/installboca.sh @@ -16,7 +16,18 @@ else bocaver=$1 fi echo "Looking for BOCA version $bocaver from http://www.ime.usp.br/~cassio/boca/" -cd /var/www +if [ "$2" == "" ]; then +basedir=/var/www +else +if [ -d "$2" ]; then +basedir=$2 +else +echo "Directory $2 does not exist" +exit 1 +fi +fi + +cd $basedir rm -f boca-$bocaver.tgz wget -O boca-$bocaver.tgz "http://www.ime.usp.br/~cassio/boca/download.php?filename=boca-$bocaver.tgz" if [ "$?" != "0" -o ! -f boca-$bocaver.tgz ]; then @@ -36,6 +47,9 @@ if [ -d boca-$bocaver ]; then echo "OLD BOCA FOLDER for version $bocaver saved as boca-$bocaver.$di" fi +echo "bocadir=$basedir/boca" > /etc/boca.conf +chmod 644 /etc/boca.conf + echo "=====================================================" echo "=================== EXTRACTING BOCA ===============" echo "=====================================================" @@ -53,35 +67,54 @@ if [ -f boca-$bocaver.$di/src/private/conf.php ]; then fi fi tar xzf boca-$bocaver.tgz -chown -R www-data.www-data boca-$bocaver/ -[ -f boca-$bocaver.$di/src/private/otherservers ] && cp -f boca-$bocaver.$di/src/private/otherservers boca-$bocaver/src/private/otherservers +chown -R root.www-data boca-$bocaver/ +chmod -R g+rx,u+rwx boca-$bocaver/ + +chmod 600 boca-$bocaver/src/private/*.php +[ -f boca-$bocaver.$di/src/private/remotescores/otherservers ] && cp -f boca-$bocaver.$di/src/private/remotescores/otherservers boca-$bocaver/src/private/remotescores/otherservers if [ "$OK" == "y" ]; then cp -f boca-$bocaver.$di/src/private/conf.php boca-$bocaver/src/private/conf.php - chown www-data.www-data boca-$bocaver/src/private/conf.php - chmod 660 boca-$bocaver/src/private/conf.php fi -chown root.root boca-$bocaver/src/private/autojudging.php -chmod 600 boca-$bocaver/src/private/autojudging.php -chown root.root boca-$bocaver/src/private/createdb.php -chmod 600 boca-$bocaver/src/private/createdb.php -chown root.root boca-$bocaver/tools/*.sh chmod 700 boca-$bocaver/tools/*.sh +cat > boca-$bocaver/src/.htaccess < boca-$bocaver/tools/.htaccess <. +# //////////////////////////////////////////////////////////////////////////////// +# // Last modified 06/aug/2012 by cassio@ime.usp.br cdir=`pwd` basen=`basename $cdir` if [ ! -f "$cdir/genpackage.sh" -o "$basen" != "tools" ]; then diff --git a/boca-1.5.0/tools/installv2.sh b/boca-1.5.0/tools/installv2.sh index 79443ba..5552aa9 100755 --- a/boca-1.5.0/tools/installv2.sh +++ b/boca-1.5.0/tools/installv2.sh @@ -15,10 +15,10 @@ # // You should have received a copy of the GNU General Public License # // along with this program. If not, see . # //////////////////////////////////////////////////////////////////////////////// -# // Last modified 05/aug/2012 by cassio@ime.usp.br +# // Last modified 06/aug/2012 by cassio@ime.usp.br #/////////////////////////////////////////////////////////////////////////////////////////// echo "#############################################################" -echo "### installv2.sh of 09/july/2012 (A) by cassio@ime.usp.br ###" +echo "### installv2.sh of 06/Aug/2012 (A) by cassio@ime.usp.br ###" echo "#############################################################" # checked with ubuntu 10.04 and 10.10 and 11.04 and 12.04 @@ -313,7 +313,7 @@ fi if [ -f /etc/icpc/installboca.sh ]; then chmod 750 /etc/icpc/installboca.sh /sbin/iptables -F - /etc/icpc/installboca.sh $3 + /etc/icpc/installboca.sh "$3" "$4" else echo "************* SCRIPT TO INSTALL BOCA NOT FOUND -- SOMETHING IS WRONG -- I CANT INSTALL BOCA **************" fi -- cgit v1.2.3