aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.0
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2012-08-06 09:38:44 +0000
committercassiopc <cassiopc@gmail.com>2012-08-06 09:38:44 +0000
commitb3dcfc7cfa76a09bcd6cdfddaf7897b88b98aa20 (patch)
tree0c024bfdcaae3b43f4bcf926c62fa55e9493ff81 /boca-1.5.0
parent866658cded5b92ddb2681dead1ebaf111d712fcc (diff)
downloadboca-b3dcfc7cfa76a09bcd6cdfddaf7897b88b98aa20.tar.gz
boca-b3dcfc7cfa76a09bcd6cdfddaf7897b88b98aa20.zip
include file /etc/boca.conf with info where is boca installed
Diffstat (limited to 'boca-1.5.0')
-rwxr-xr-xboca-1.5.0/tools/autojudge.sh25
-rw-r--r--boca-1.5.0/tools/etc/icpc/installboca.sh65
-rwxr-xr-xboca-1.5.0/tools/genpackage.sh17
-rwxr-xr-xboca-1.5.0/tools/installv2.sh6
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 <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // 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 <<EOF
+php_flag output_buffering on
+php_value memory_limit 256M
+php_value post_max_size 128M
+php_flag magic_quotes_gpc off
+php_value upload_max_filesize 128M
+EOF
+chmod 755 boca-$bocaver/src/.htaccess
+cat > boca-$bocaver/tools/.htaccess <<EOF
+Deny from all
+EOF
+chmod 755 boca-$bocaver/tools/.htaccess
+cp boca-$bocaver/tools/.htaccess boca-$bocaver/doc/.htaccess
+cp boca-$bocaver/tools/.htaccess boca-$bocaver/old/.htaccess
+cp boca-$bocaver/tools/.htaccess boca-$bocaver/src/private/.htaccess
+cp boca-$bocaver/tools/.htaccess boca-$bocaver/src/webcast/.htaccess
+
+chmod -R 770 boca-$bocaver/src/balloons
+chmod -R 770 boca-$bocaver/src/private/problemtmp
+chmod -R 770 boca-$bocaver/src/private/runtmp
+chmod -R 770 boca-$bocaver/src/private/scoretmp
+chmod -R 770 boca-$bocaver/src/private/remotescores
+
echo "=========================================================================================="
echo "=========== SETTING UP SOME LINKS (main apache server index.html updated) ==============="
echo "=========================================================================================="
-rm -f /var/www/boca /usr/bin/makebkp.sh
-ln -s /var/www/boca-$bocaver /var/www/boca
-ln -s /var/www/boca/tools/makebkp.sh /usr/bin/makebkp.sh
-chmod 755 /var/www/boca/tools/makebkp.sh
-chmod 755 /var/www/boca/tools/singlefilebkp.sh
+rm -f $basedir/boca /usr/bin/makebkp.sh
+ln -s $basedir/boca-$bocaver $basedir/boca
+ln -s $basedir/boca/tools/makebkp.sh /usr/bin/makebkp.sh
+chmod 755 $basedir/boca/tools/makebkp.sh
+chmod 755 $basedir/boca/tools/singlefilebkp.sh
echo "=============================================================="
echo "================== COMPILING safeexec utility ==============="
echo "=============================================================="
-cd /var/www/boca/tools
+cd $basedir/boca/tools
gcc -static -O2 -Wall safeexec.c -o safeexec
if [ $? == 0 ]; then
echo "COMPILATION OK"
diff --git a/boca-1.5.0/tools/genpackage.sh b/boca-1.5.0/tools/genpackage.sh
index 0a61c3a..18caac2 100755
--- a/boca-1.5.0/tools/genpackage.sh
+++ b/boca-1.5.0/tools/genpackage.sh
@@ -1,4 +1,21 @@
#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //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 <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // 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 <http://www.gnu.org/licenses/>.
# ////////////////////////////////////////////////////////////////////////////////
-# // 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