From 2948fe8d6055f6dfe6289e64bce426b5e0bb552f Mon Sep 17 00:00:00 2001 From: cassiopc Date: Fri, 31 Aug 2012 11:02:27 +0200 Subject: inclusion of dir 1.5.1 for boca --- boca-1.5.1/tools/etc/icpc/installboca.sh | 165 +++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 boca-1.5.1/tools/etc/icpc/installboca.sh (limited to 'boca-1.5.1/tools/etc/icpc/installboca.sh') diff --git a/boca-1.5.1/tools/etc/icpc/installboca.sh b/boca-1.5.1/tools/etc/icpc/installboca.sh new file mode 100644 index 0000000..8f35e74 --- /dev/null +++ b/boca-1.5.1/tools/etc/icpc/installboca.sh @@ -0,0 +1,165 @@ +#!/bin/bash +di=`date +%s` +echo "===================================================" +echo "=================== obtaining BOCA ===============" +echo "===================================================" + +wget -O /tmp/.boca.tmp "http://www.ime.usp.br/~cassio/boca/boca.date.txt" +echo ">>>>>>>>>>" +echo ">>>>>>>>>> Downloading boca release `cat /tmp/.boca.tmp`" +echo ">>>>>>>>>>" + +if [ "$1" == "" ]; then +wget -O /tmp/.boca.tmp "http://www.ime.usp.br/~cassio/boca/bocaver.txt" +bocaver=`cat /tmp/.boca.tmp` +else +bocaver=$1 +fi +echo "Looking for BOCA version $bocaver from http://www.ime.usp.br/~cassio/boca/" +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 + echo "ERROR downloading BOCA package version $bocaver. Aborting *****************" + exit 1 +fi +grep -qi "bad parameters" boca-$bocaver.tgz +if [ "$?" == "0" ]; then + echo "ERROR downloading BOCA package version $bocaver. Aborting *****************" + exit 1 +fi +echo "===========================================================" +echo "====================== BACKUPING OLD BOCA ===============" +echo "===========================================================" +if [ -d boca-$bocaver ]; then + mv boca-$bocaver boca-$bocaver.$di + 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 "=====================================================" + +OK=x +if [ -f boca-$bocaver.$di/src/private/conf.php ]; then + echo "OLD CONFIG FILE EXISTS" + OK=x + while [ "$OK" != "y" -a "$OK" != "n" ]; do + OK=x + read -p "Do you want to keep the old private/conf.php file [y/n] (note that the old file might be incompatible with this version)? " OK + done + if [ "$OK" == "n" ]; then + echo "You probably need to update the new file boca-$bocaver/src/private/conf.php with the correct passwords - PLEASE CHECK IT - NOT DONE AUTOMATICALLY" + fi +fi + +apacheuser= +[ -r /etc/icpc/apacheuser ] && apacheuser=`cat /etc/icpc/apacheuser | sed 's/ \t\n//g'` +[ "$apacheuser" == "" ] && apacheuser=www-data +id -u $apacheuser >/dev/null 2>/dev/null +if [ $? != 0 ]; then + echo "User $apacheuser not found -- error to set permissions with chown/chmod" + apacheuser=root +fi + +tar xzf boca-$bocaver.tgz +chown -R root.$apacheuser 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 +fi +chmod 700 boca-$bocaver/tools/*.sh + +cat > boca-$bocaver/src/.htaccess < boca-$bocaver/tools/.htaccess < /etc/apache2/conf.d/boca < + AllowOverride Options AuthConfig Limit + Order Allow,Deny + Allow from all + AddDefaultCharset utf-8 + + + AllowOverride Options AuthConfig Limit + Deny from all + + + AllowOverride Options AuthConfig Limit + Deny from all + +Alias /boca $basedir/boca/src +EOF -- cgit v1.2.3