aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/boca-auth-runs4
-rwxr-xr-xtools/boca-submit-run-aux6
-rw-r--r--tools/etc/apache2/conf.d/boca15
-rw-r--r--tools/etc/cron.hourly/.placeholder2
-rwxr-xr-xtools/etc/cron.hourly/ntp2
-rwxr-xr-xtools/etc/icpc/becomeserver.sh273
-rwxr-xr-xtools/etc/icpc/cleandisk.sh4
-rwxr-xr-xtools/etc/icpc/createbocajail.sh137
-rwxr-xr-xtools/etc/icpc/doclean.sh29
-rwxr-xr-xtools/etc/icpc/installboca.sh251
-rwxr-xr-xtools/etc/icpc/restart.sh31
-rwxr-xr-xtools/etc/icpc/setup.sh98
-rwxr-xr-xtools/etc/icpc/update.sh20
-rwxr-xr-xtools/etc/icpc/updatedbpass.sh85
-rw-r--r--tools/etc/network/if-pre-up.d/boca30
-rw-r--r--tools/etc/network/if-up.d/boca30
-rwxr-xr-xtools/etc/rc.local35
-rw-r--r--tools/etc/sysctl.d/10-shmmax.conf2
-rw-r--r--tools/etc/sysctl.d/10-vm-swappiness.conf1
-rwxr-xr-xtools/genpackage.sh64
-rw-r--r--tools/getrunlist.sh57
-rw-r--r--tools/icpc.etc.tgzbin9525 -> 0 bytes
-rwxr-xr-xtools/install_12_04.sh405
-rwxr-xr-xtools/installv2.sh373
-rwxr-xr-xtools/sendscore.sh69
-rwxr-xr-xtools/singlefilebkp.sh6
-rwxr-xr-xtools/updatescore.sh141
27 files changed, 8 insertions, 2162 deletions
diff --git a/tools/boca-auth-runs b/tools/boca-auth-runs
index c03fc4f..565bbd1 100755
--- a/tools/boca-auth-runs
+++ b/tools/boca-auth-runs
@@ -26,13 +26,13 @@ for i in wget sha256sum cut; do
done
temp=/tmp/.temp.`date +%s%N`.txt
-md=`wget -t 2 -T 5 -S http://$BOCASERVER/boca/getcode.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
+md=`wget -t 2 -T 5 -S https://$BOCASERVER/boca/getcode.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
echo "$md" | grep -q PHPSESS
if [ "$?" == "0" ]; then
md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
ress=`echo -n $pass | sha256sum - | cut -f1 -d' '`
res=`echo -n "${ress}${md}" | sha256sum - | cut -f1 -d' '`
- wget -t 2 -T 5 "http://$BOCASERVER/boca/getcode.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
+ wget -t 2 -T 5 "https://$BOCASERVER/boca/getcode.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
grep -qi incorrect $temp
if [ $? == 0 ]; then
echo ""
diff --git a/tools/boca-submit-run-aux b/tools/boca-submit-run-aux
index 1398899..eec370e 100755
--- a/tools/boca-submit-run-aux
+++ b/tools/boca-submit-run-aux
@@ -23,13 +23,13 @@ for i in uuencode wget tr perl sha256sum cut; do
done
temp=/tmp/.temp.`date +%s%N`.txt
-md=`wget -t 2 -T 5 -S http://$BOCASERVER/boca/index.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
+md=`wget -t 2 -T 5 -S https://$BOCASERVER/boca/index.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
echo "$md" | grep -q PHPSESS
if [ "$?" == "0" ]; then
md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
res=`echo -n $pass | sha256sum - | cut -f1 -d' '`
res=`echo -n "${res}${md}" | sha256sum - | cut -f1 -d' '`
- wget -t 2 -T 5 "http://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
+ wget -t 2 -T 5 "https://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
grep -qi incorrect $temp
if [ $? == 0 ]; then
echo "$BOCASERVER: User or password incorrect"
@@ -62,7 +62,7 @@ if [ "$?" == "0" ]; then
echo -n "&problem=`echo -n $problem | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
echo -n "&language=`echo -n $language | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
echo -n "&data=`echo -n $data | tr -d ' ' | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
- wget -t 2 -T 5 "http://$BOCASERVER/boca/team/run.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
+ wget -t 2 -T 5 "https://$BOCASERVER/boca/team/run.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
res=`tail -n1 ${temp}.out`
echo $res | grep -q "RESULT:"
diff --git a/tools/etc/apache2/conf.d/boca b/tools/etc/apache2/conf.d/boca
deleted file mode 100644
index 66c62fe..0000000
--- a/tools/etc/apache2/conf.d/boca
+++ /dev/null
@@ -1,15 +0,0 @@
-<Directory /var/www/boca/src>
- AllowOverride Options AuthConfig Limit
- Order Allow,Deny
- Allow from all
- AddDefaultCharset utf-8
-</Directory>
-<Directory /var/www/boca/src/private>
- AllowOverride Options AuthConfig Limit
- Deny from all
-</Directory>
-<Directory /var/www/boca>
- AllowOverride Options AuthConfig Limit
- Deny from all
-</Directory>
-Alias /boca /var/www/boca/src
diff --git a/tools/etc/cron.hourly/.placeholder b/tools/etc/cron.hourly/.placeholder
deleted file mode 100644
index 76cb8d0..0000000
--- a/tools/etc/cron.hourly/.placeholder
+++ /dev/null
@@ -1,2 +0,0 @@
-# DO NOT EDIT OR REMOVE
-# This file is a simple placeholder to keep dpkg from removing this directory
diff --git a/tools/etc/cron.hourly/ntp b/tools/etc/cron.hourly/ntp
deleted file mode 100755
index 8f1cda9..0000000
--- a/tools/etc/cron.hourly/ntp
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-ntpdate -u 198.60.22.240
diff --git a/tools/etc/icpc/becomeserver.sh b/tools/etc/icpc/becomeserver.sh
deleted file mode 100755
index 7f1cf1b..0000000
--- a/tools/etc/icpc/becomeserver.sh
+++ /dev/null
@@ -1,273 +0,0 @@
-#!/bin/bash
-# ////////////////////////////////////////////////////////////////////////////////
-# //BOCA Online Contest Administrator
-# // Copyright (C) 2003-2014 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 15/aug/2014 by cassio@ime.usp.br
-for i in id chown chmod cut awk grep cat sed makepasswd ifconfig iptables php touch mkdir update-rc.d su rm mv; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-bkpserver=0
-if [ "$1" == "bkp" ]; then
- if [ "$2" == "" ]; then
- echo "Usage $0 bkp <IP-number-of-main-server>"
- exit 1
- else
- bkpserver=$2
- fi
-fi
-
-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
-
-privatedir=$bocadir/src/private
-if [ ! -d $privatedir ]; then
- echo "Could not find directory $privatedir"
- exit 1
-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
-
-postgresuser=postgres
-id -u $postgresuser >/dev/null 2>/dev/null
-if [ $? != 0 ]; then
- echo "User $postgresuser not found -- maybe you use another name (then update this script) or postgres is not installed"
- exit 1
-fi
-
-grep -iq "iface.*eth0.*inet.*static" /etc/network/interfaces
-if [ $? != 0 ]; then
- echo "*****************************************"
- echo "IMPORTANT NOTICE ************************"
- echo "Network interface eth0 has to be set with"
- echo "a static IP address for this computer to "
- echo "be a proper server -- DO IT ASAP ********"
- echo "*****************************************"
- sleep 2
-fi
-
-BOCASERVER=localhost
-if [ -f /etc/icpc/postgresql.version ]; then
- . /etc/icpc/postgresql.version
-else
-POSTGRESV=""
-if [ ! -f /etc/init.d/postgresql ]; then
- POSTGRESV="-8.4"
-fi
-fi
-if [ ! -f /etc/init.d/postgresql$POSTGRESV ]; then
- echo "I did not find the correct version of postgres -- please check it and update this script"
- exit 1
-fi
-
-for i in `ls /etc/postgresql/*/main/pg_hba.conf`; do
- grep -q "host.*bocadb.*bocauser" $i
- if [ $? != 0 ]; then
- echo "############"
- echo "I AM GIVING ACCESS TO THE DATABASE FROM ANY IP (AS LONG AS THE PASSWORD IS OK)"
- echo "In order to improve security, it is possible to alter the file $i"
- echo "and perform a finer tune. Nevertheless, if the password of the DB is safe, there is no big threat"
- echo "For doing that, I am using the line:"
- echo ""
- echo -e "echo \"host bocadb bocauser 0/0 md5\" >> $i"
- echo -e "echo \"host postgres replication 0/0 md5\" >> $i"
- echo ""
- echo "==> IDEALLY FOR IMPROVED SECURITY, REPLACE THE FIRST 0/0 ABOVE (IN THAT FILE) WITH THE IP ADDRESS OF THE AUTOJUDGE MACHINE <=="
- echo "==> IF YOU HAVE MULTIPLE AUTOJUDGE MACHINES, WRITE ONE LINE FOR EACH IP ADDRESS THERE IN THE FILE <=="
- echo "==> IDEALLY FOR IMPROVED SECURITY, REPLACE THE SECOND 0/0 ABOVE (FOR REPLICATION) WITH THE IP ADDRESS OF THE REPLICATION MACHINE <=="
- echo "############"
- echo "host bocadb bocauser 0/0 md5" >> $i
- echo "host postgres replication 0/0 md5" >> $i
- else
- echo "############"
- echo "IT SEEMS YOU ALREADY HAVE MODIFIED THE FILE $i WITH BOCA'S INFORMATION"
- echo "I WOULD USE THE LINE:"
- echo ""
- echo -e "echo \"host bocadb bocauser 0/0 md5\" >> $i"
- echo -e "echo \"host postgres replication 0/0 md5\" >> $i"
- echo ""
- echo "to give access to the database to other computers, but"
- echo ">>> I'M NOT DOING IT -- PLEASE CHECK IT <<<"
- echo "############"
- fi
-done
-
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*listen_addresses" $i
-if [ $? != 0 ]; then
- echo "listen_addresses = '*'" >> $i
-fi
-done
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*max_connections" $i
-if [ $? != 0 ]; then
- echo "max_connections = 100" >> $i
-fi
-done
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*maintenance_work_mem" $i
-if [ $? != 0 ]; then
- echo "maintenance_work_mem = 64MB" >> $i
-fi
-done
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*shared_buffers" $i
-if [ $? != 0 ]; then
- echo "shared_buffers = 128MB" >> $i
-fi
-done
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*work_mem" $i
-if [ $? != 0 ]; then
- echo "work_mem = 4MB" >> $i
-fi
-done
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*max_wal_senders" $i
-if [ $? != 0 ]; then
- echo "max_wal_senders = 3" >> $i
-fi
-done
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*wal_level" $i
-if [ $? != 0 ]; then
- echo "wal_level = hot_standby" >> $i
-fi
-done
-for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-grep -q "^[^\#]*wal_keep_segments" $i
-if [ $? != 0 ]; then
- echo "wal_keep_segments = 100" >> $i
-fi
-done
-
-# for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-# grep -q "^[^\#]*archive_mode" $i
-# if [ $? != 0 ]; then
-# echo "archive_mode = on" >> $i
-# fi
-# done
-# for i in `ls /etc/postgresql/*/main/postgresql.conf`; do
-# grep -q "^[^\#]*archive_command" $i
-# if [ $? != 0 ]; then
-# echo "archive_command = 'test ! -f /var/www/pg_archive/%f.gz && gzip < %p > /var/www/pg_archive/%f.gz && chmod 640 /var/www/pg_archive/%f.gz''" >> $i
-# fi
-# done
-# mkdir -p /var/www/pg_archive
-# chown postgres:icpcadmin /var/www/pg_archive
-# chmod 6770 /var/www/pg_archive
-
-echo "You need to define a password to be used in the database."
-echo "IF THIS IS A BKP SERVER, PLEASE USE THE SAME AS IN THE MAIN SERVER."
-echo -n "It is possible generate a random one. Want a random password "
-read -p "[Y/n]? " OK
-if [ "$OK" = "n" ]; then
- read -p "Enter DB password: " -s PASS
-else
- PASS=`makepasswd --char 10`
- echo "The DB password is $PASS"
-fi
-echo "Keep the DB password safe!"
-echo "The IP address that is computer is using is"
-echo "(check using the command ifconfig, if desired. Use this address to configure other computers)"
-ifconfig eth0 | grep -i "inet addr"
-
-PASSK=`makepasswd --chars 20`
-awk -v boca="$BOCASERVER" -v pass="$PASS" -v passk="$PASSK" '{ if(index($0,"[\"dbpass\"]")>0) \
- print "$conf[\"dbpass\"]=\"" pass "\";"; \
- else if(index($0,"[\"dbhost\"]")>0) print "$conf[\"dbhost\"]=\"" boca "\";"; \
- else if(index($0,"[\"dbsuperpass\"]")>0) print "$conf[\"dbsuperpass\"]=\"" pass "\";"; \
- else if(index($0,"[\"key\"]")>0) print "$conf[\"key\"]=\"" passk "\";"; else print $0; }' \
- < $privatedir/conf.php > $privatedir/conf.php1
-mv -f $privatedir/conf.php1 $privatedir/conf.php
-echo "Deny from all" > $privatedir/.htaccess
-chown -R $apacheuser.root $privatedir
-chmod -R u+rw,g+rw,o-rw $privatedir
-iptables -F
-echo "BOCASERVER=0/0" > /etc/icpc/bocaserver.sh
-
-
-grep -iq "^[^\#]*ServerName" /etc/apache2/apache2.conf
-if [ $? != 0 ]; then
- echo "ServerName boca" >> /etc/apache2/apache2.conf
-fi
-
-/etc/init.d/apache2 restart
-mkdir -p /var/run/postgresql
-chown $postgresuser.$postgresuser /var/run/postgresql
-/etc/init.d/postgresql$POSTGRESV restart
-update-rc.d apache2 defaults
-update-rc.d postgresql$POSTGRESV defaults
-
-rm -f /tmp/.boca.tmp
-su - $postgresuser -c "echo select contestnumber from contesttable | psql -d bocadb | grep contestnumber >/tmp/.boca.tmp 2>/tmp/.boca.tmp"
-su - $postgresuser -c "echo drop user bocauser | psql -d template1 >/dev/null 2>/dev/null"
-su - $postgresuser -c "echo create user bocauser createdb password \'$PASS\' | psql -d template1"
-su - $postgresuser -c "echo alter user bocauser createdb password \'$PASS\' | psql -d template1"
-
-OK=y
-grep -qi contestnumber /tmp/.boca.tmp
-if [ $? == 0 ]; then
- OK=x
- while [ "$OK" != "y" -a "$OK" != "n" ]; do
- echo "====== An old database seems to exist. I can keep it, but it might not work with the version"
- echo -n "of BOCA being installed. May I erase all the content of the bocadb database [y/n]"
- OK=x
- read -p "?" OK
- done
-fi
-if [ "$OK" == "y" ]; then
-cd $bocadir/src
-php private/createdb.php
-cd - >/dev/null 2>/dev/null
- echo "database renewed. Data on bocadb has been lost"
-else
- echo "*** database not erased. Check if BOCA is compatible. You can always erase the database and"
- echo "*** fix the problem by running (as root) cd $bocadir/src; php private/createdb.php"
- echo "*** still, all data regarding BOCA in the database will be lost"
-fi
-touch /etc/icpc/.isserver
-
-if [ "$bkpserver" != "0" ]; then
- echo "Connecting to main server at $bkpserver to initialize the database -- pay attention in the following messages"
- for i in `ls -d /var/lib/postgresql/*/main`; do
- echo "standby_mode = \'on\'" > $i/recovery.conf
- chmod 600 $i/recovery.conf
- echo "primary_conninfo = \'host=$bkpserver port=5432 user=postgres password=$PASS\'" >> $i/recovery.conf
- chown $postgresuser $i/recovery.conf
- su - $postgresuser -c "pg_basebackup -D $i -w -R --xlog-method=stream --dbname=\'host=$bkpserver user=postgres port=5432 password=$PASS\'"
- done
- echo "=-=-=-= CHECK IF THE PREVIOUS MESSAGES HAVE NO ERRORS =-=-=-="
-fi
-
-echo "configuration finished. Boca should be available at http://localhost/boca/"
-echo "reboot might not be required, but is advised."
diff --git a/tools/etc/icpc/cleandisk.sh b/tools/etc/icpc/cleandisk.sh
deleted file mode 100755
index 0d177de..0000000
--- a/tools/etc/icpc/cleandisk.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-mkdir -p /home/icpc
-/usr/bin/touch /home/icpc/.cleandisk.sh
diff --git a/tools/etc/icpc/createbocajail.sh b/tools/etc/icpc/createbocajail.sh
deleted file mode 100755
index a74d001..0000000
--- a/tools/etc/icpc/createbocajail.sh
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-homejail=/home/bocajail
-[ "$1" != "" ] && homejail=$1
-echo "================================================================================="
-echo "============= CREATING $homejail (this might take some time) ==============="
-echo "================================================================================="
-for i in setquota ln id chown chmod dirname useradd mkdir cp rm mv apt-get dpkg uname debootstrap schroot; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-if [ "`id -u`" != "0" ]; then
- echo "Must be run as root"
- exit 1
-fi
-if [ ! -r /etc/lsb-release ]; then
- echo "File /etc/lsb-release not found. Is this a ubuntu or debian-like distro?"
- echo "If so, execute the command"
- echo ""
- echo "DISTRIB_CODENAME=WXYZ > /etc/lsb-release"
- echo ""
- echo "to save the release name to that file (replace WXYZ with your distro codename)"
- exit 1
-fi
-. /etc/lsb-release
-if [ -d /bocajail/ ]; then
- echo "You seem to have already a /bocajail installed"
- echo "If you want to reinstall, remove it first (e.g. rm /bocajail) and then run /etc/icpc/createbocajail.sh"
- exit 1
-fi
-
-if [ -f $homejail/proc/cpuinfo ]; then
- echo "You seem to have already installed /bocajail and the /bocajail/proc seems to be mounted"
- chroot $homejail umount /sys >/dev/nul 2>/dev/null
- chroot $homejail umount /proc >/dev/nul 2>/dev/null
- echo "Please reboot the system to remove such mounted point"
- exit 1
-fi
-
-id -u bocajail >/dev/null 2>/dev/null
-if [ $? != 0 ]; then
- useradd -m -s /bin/bash -d $homejail -g users bocajail
- cat <<EOF > /var/lib/AccountsService/users/bocajail
-[User]
-SystemAccount=true
-EOF
- sleep 1
-else
- echo "user bocajail already exists"
- echo "if you want to proceed, first remove it (e.g. userdel bocajail) and then run /etc/icpc/createbocajail.sh"
- exit 1
-fi
-setquota -u bocajail 0 500000 0 10000 -a
-
-rm -rf /bocajail
-mkdir -p $homejail/tmp
-chmod 1777 $homejail/tmp
-ln -s $homejail /bocajail
-#for i in usr lib var bin sbin etc dev; do
-# [ -d $homejail/$i ] && rm -rf $homejail/$i
-# cp -ar /$i $homejail
-#done
-#rm -rf $homejail/var/lib/postgres*
-#rm -rf $homejail/var/www/*
-#mkdir -p $homejail/proc
-#mkdir -p $homejail/sys
-uname -m | grep -q 64
-if [ $? == 0 ]; then
- archt=amd64
-else
- archt=i386
-fi
-
-cat <<FIM > /etc/schroot/chroot.d/bocajail.conf
-[bocajail]
-description=Jail
-directory=$homejail
-root-users=root
-type=directory
-users=bocajail,nobody,root
-FIM
-
-#debootstrap --arch $archt $DISTRIB_CODENAME $homejail
-debootstrap $DISTRIB_CODENAME $homejail
-if [ $? != 0 ]; then
- echo "bocajail failed to debootstrap"
- exit 1
-else
-schroot -l | grep -q bocajail
-if [ $? == 0 ]; then
- echo "bocajail successfully installed at $homejail"
-else
- echo "*** some error has caused bocajail not to install properly -- I will try it again with different parameters"
- echo "location=$homejail" >> /etc/schroot/chroot.d/bocajail.conf
- debootstrap $DISTRIB_CODENAME $homejail
- schroot -l | grep -q bocajail
- if [ $? == 0 ]; then
- echo "*** bocajail successfully installed at $homejail"
- else
- echo "*** bocajail failed to install"
- exit 1
- fi
-fi
-fi
-
-echo "*** Populating $homejail"
-cat <<EOF > /home/bocajail/tmp/populate.sh
-#!/bin/bash
-mount -t proc proc /proc
-
-echo "LC_ALL=en_US.UTF-8" > /etc/default/locale
-echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
-/usr/sbin/locale-gen
-/usr/sbin/update-locale
-apt-get -y update
-apt-get -y install python-software-properties software-properties-common
-add-apt-repository -y ppa:brunoribas/ppa-maratona
-apt-get -y update
-apt-get -y upgrade
-apt-get -y install maratona-linguagens --no-install-recommends --allow-unauthenticated
-apt-get -y clean
-
-umount /proc
-EOF
-mkdir -p /bocajail/usr/bin
-[ -x /usr/bin/safeexec ] && cp -a /usr/bin/safeexec /bocajail/usr/bin/
-cp -f /etc/apt/sources.list $homejail/etc/apt/
-chmod 755 /home/bocajail/tmp/populate.sh
-
-export LC_ALL=en_US.UTF-8
-cd / ; chroot $homejail /tmp/populate.sh
-
-
diff --git a/tools/etc/icpc/doclean.sh b/tools/etc/icpc/doclean.sh
deleted file mode 100755
index 40b49c1..0000000
--- a/tools/etc/icpc/doclean.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-cd /home
-if [ -f /home/icpc/.cleandisk.sh ]; then
-rm -rf /home/icpc
-find /home -user icpc -delete
-if [ -x /usr/bin/makepasswd ]; then
- pass=`echo -n icpc | /usr/bin/makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-`
- pass=\$`echo $pass`
- id -u icpc >/dev/null 2>/dev/null
- if [ $? != 0 ]; then
- useradd -d /home/icpc -k /etc/skel -m -p "$pass" -s /bin/bash -g users icpc
- else
- usermod -d /home/icpc -p "$pass" -s /bin/bash -g users icpc
- fi
-fi
-for i in media mnt var opt tmp usr; do
- find /$i -user icpc -delete
-done
-if [ ! -d /home/icpc ]; then
- rm -rf /home/icpc
- rm -rf /home/skel
- cp -ar /etc/skel/ /home
- mv /home/skel /home/icpc
-fi
-chown -R icpc.users /home/icpc
-chmod -R u+rwx /home/icpc
-fi
-cd - >/dev/null
-exit 0
diff --git a/tools/etc/icpc/installboca.sh b/tools/etc/icpc/installboca.sh
deleted file mode 100755
index d796c04..0000000
--- a/tools/etc/icpc/installboca.sh
+++ /dev/null
@@ -1,251 +0,0 @@
-#!/bin/bash
-if [ "`id -u`" != "0" ]; then
- echo "Script must run as root"
-fi
-
-di=`date +%s`
-local=0
-if [ "$1" == "local" ]; then
- local=1
- echo "==========USING LOCAL FILE $2==========="
- if [ ! -r "$2" ]; then
- echo "======NOT FOUND: $2==========="
- exit 1
- else
- echo "USING LOCAL FILE: $2"
- basedir=`dirname "$2"`
- echo $basedir | grep -q '^/' 2> /dev/null
- if [ $? == 0 ]; then
- basenam=`basename "$2" .tgz`
- bocaver=`echo $basenam | cut -d'-' -f2-`
- echo "INSTALLING ON $basedir"
- echo "INSTALLING VERSION $bocaver"
- echo "=========="
- else
- echo "======YOU MUST PROVIDE FULL PATH OF FILE $2====="
- exit 1
- fi
- fi
-else
- 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
- basedir=$2
-fi
-
-if [ "$basedir" == "" ]; then
- basedir=/var/www
-fi
-if [ ! -d "$basedir" ]; then
- echo "Directory $2 does not exist"
- exit 1
-fi
-
-OK=y
-read -p "I will install boca at $basedir is it correct (otherwise, run this script as: $0 $bocaver <installdir> to choose the place) [y/n]? " OK
-if [ "$OK" == "y" -o "$OK" == "Y" ]; then
- echo "Install directory is $basedir"
-else
- echo "Aborted"
- exit 1
-fi
-
-if [ "$local" == "0" ]; then
- echo "Looking for BOCA version $bocaver from http://www.ime.usp.br/~cassio/boca/"
- 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
-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
-conffile=boca/src/private/conf.php
-if [ ! -f $conffile ]; then
-conffile=boca-$bocaver.$di/src/private/conf.php
-fi
-if [ -f $conffile ]; 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
-else
- echo "OLD Config file not found -- you must set up the new private/conf.php file properly"
-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 $conffile boca-$bocaver/src/private/conf.php
- [ -f boca-$bocaver.$di/src/private/run-using-command.config ] && cp -f boca-$bocaver.$di/src/private/run-using-command.config boca-$bocaver/src/private/run-using-command.config
-fi
-chmod 700 boca-$bocaver/tools/*.sh
-
-if [ -f boca-$bocaver.$di/src/private/run-past.config ]; then
- cp -f boca-$bocaver.$di/src/private/run-past.config boca-$bocaver/src/private/run-past.config
-else
- echo "`date +%sN`-sha256sum-`date +%sN`" | sha256sum - | cut -d' ' -f1 > boca-$bocaver/src/private/run-past.config
-fi
-chmod 550 boca-$bocaver/src/private/run-past.config
-chown www-data.www-data boca-$bocaver/src/private/run-past.config
-
-cp boca-$bocaver/tools/boca-submit-run* /usr/bin/
-chmod 755 /usr/bin/boca-submit-run*
-chmod 700 /usr/bin/boca-submit-run-cron
-
-cat > /tmp/boca-submit-run-root-wrapper.c <<EOF
-#include<stdlib.h>
-#include<stdio.h>
-#include<sys/types.h>
-#include<unistd.h>
-char str[10000];
-int main(int argc, char **argv) {
- if(argc != 8) return 1;
- sprintf(str,"/usr/bin/boca-submit-run-root %1000s %1000s %1000s %1000s %1000s %1000s %1000s",argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],argv[7]);
- setuid(0);
- system(str);
- return 0;
-}
-EOF
-gcc -o /usr/bin/boca-submit-run-root-wrapper /tmp/boca-submit-run-root-wrapper.c
-rm -f /tmp/boca-submit-run-root-wrapper.c
-chown root.root /usr/bin/boca-submit-run-root-wrapper
-chmod 4555 /usr/bin/boca-submit-run-root-wrapper
-echo "*/2 * * * * root /usr/bin/boca-submit-run-cron >>/var/log/bocacron.out 2>>/var/log/bocacron.err" > /etc/cron.d/boca
-
-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
-
-chmod -R 770 boca-$bocaver/src/private
-chmod -R 775 boca-$bocaver/src/balloons
-
-echo "=========================================================================================="
-echo "=========== SETTING UP SOME LINKS (main apache server index.html updated) ==============="
-echo "=========================================================================================="
-
-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 $basedir/boca/tools
-gcc -static -O2 -Wall safeexec.c -o safeexec
-if [ $? == 0 ]; then
- echo "COMPILATION OK"
-fi
-strip safeexec
-cp -f safeexec /usr/bin
-chmod 4555 /usr/bin/safeexec
-[ -d /bocajail/usr/bin ] && cp -a /usr/bin/safeexec /bocajail/usr/bin/
-
-if [ -f /etc/icpc/installboca.sh ]; then
- cp $basedir/boca/tools/etc/icpc/installboca.sh /etc/icpc/installboca.sh
- chmod 700 /etc/icpc/installboca.sh
-fi
-
-echo "=================================================="
-echo "=================== SERVER SETUP ==============="
-echo "=================================================="
-ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini 2>/dev/null
-ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini 2>/dev/null
-
-OK=n
-echo "You can run at anytime later the script /etc/icpc/becomeserver.sh to prepare the computer to be the BOCA server"
-read -p "Do you want me to call the script to make this computer the server (don't do it if this install is for a team or autojudge) [y/N]? " OK
-if [ "$OK" == "y" -o "$OK" == "Y" ]; then
- OK=n
- read -p "Do you really want to make this computer the server? (DONT DO IT if you are only upgrading BOCA) [y/N]? " OK
- if [ "$OK" == "y" -o "$OK" == "Y" ]; then
- /etc/icpc/becomeserver.sh
- fi
-fi
-
-cat > /etc/apache2/conf.d/boca <<EOF
-<Directory $basedir/boca/src>
- AllowOverride Options AuthConfig Limit
- Order Allow,Deny
- Allow from all
- AddDefaultCharset utf-8
-</Directory>
-<Directory $basedir/boca/src/private>
- AllowOverride Options AuthConfig Limit
- Deny from all
-</Directory>
-<Directory $basedir/boca>
- AllowOverride Options AuthConfig Limit
- Deny from all
-</Directory>
-Alias /boca $basedir/boca/src
-EOF
-
-ln -s /etc/apache2/conf.d/boca /etc/apache2/conf-enabled/boca.conf 2>/dev/null
diff --git a/tools/etc/icpc/restart.sh b/tools/etc/icpc/restart.sh
deleted file mode 100755
index 8c6c98c..0000000
--- a/tools/etc/icpc/restart.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-uid=`id -u`
-if [ "$uid" != "0" ]; then
- echo "Must be root to run this script. Use sudo /bin/bash first"
- exit 1
-fi
-
-apt-get clean
-if [ -f /etc/icpc/postgresql.version ]; then
- . /etc/icpc/postgresql.version
-else
-POSTGRESV=""
-if [ ! -f /etc/init.d/postgresql ]; then
- POSTGRESV="-8.4"
-fi
-fi
-
-pass=\$`echo -n icpc | makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-`
-usermod -p "$pass" icpc
-
-rm -f /etc/icpc/.isserver
-rm -f /etc/icpc/.firsttimedone
-rm -f /etc/icpc/bocaserver.sh
-/etc/icpc/cleandisk.sh
-/etc/init.d/apache2 stop
-/etc/init.d/postgresql$POSTGRESV stop
-rm -f /var/log/apache2/*
-rm -f /var/log/postgresql/*
-update-rc.d -f apache2 remove
-update-rc.d -f postgresql$POSTGRESV remove
-
diff --git a/tools/etc/icpc/setup.sh b/tools/etc/icpc/setup.sh
deleted file mode 100755
index 62563e1..0000000
--- a/tools/etc/icpc/setup.sh
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/bash
-
-if [ ! -x /etc/icpc/bocaserver.sh ]; then
- OK=1
- while [ "$OK" != "0" ]; do
- IP=`zenity --title="Setting up the BOCA server IP number" --text="Enter the IP address of the server (format x.y.w.z)\n\
-If this is supposed to be the server, then leave it empty\nIf there are multiple servers, separate IPs by a semi-colon ;" --entry`
- [ "$IP" == "" ] && IP=LOCAL
- zenity --title="IP confirmation" --text="The chosen IP is $IP\nDo you confirm?" --question
- OK=$?
- done
- if [ "$IP" = "local" -o "$IP" = "LOCAL" ]; then
- IP=127.0.0.1
- BOCASERVER=0/0
- fi
- FIRSTBOCA=`echo $IP | cut -d';' -f1`
- echo "BOCASERVER=$FIRSTBOCA" > /etc/icpc/bocaserver.sh
- echo $IP | grep -q ';'
- if [ "$?" == "0" ]; then
- echo "BOCASERVERS=`echo $IP | cut -d';' -f2-`" >> /etc/icpc/bocaserver.sh
- fi
- echo "$FIRSTBOCA boca boca" >> /etc/hosts
- chmod 755 /etc/icpc/bocaserver.sh
-fi
-. /etc/icpc/bocaserver.sh
-
-if [ ! -f /etc/icpc/.firsttimedone ]; then
-
- zenity --title="PAY ATTENTION TO THE FOLLOWING:" \
- --text="It is HIGHLY recommended that you set up a super-user password NOW. Set up the super-user password now?" --question
- OK=$?
- if [ "$OK" == "0" ]; then
- id -u icpcadmin 2>\dev\null >\dev\null
- if [ "$?" == "0" ]; then
- OK=1
- while [ $OK != 0 ]; do
- pass=`zenity --title="Setting up a icpcadmin password" --text="Take care \
- to keep it safe. icpcadmin is the user that \n\
- can become root using the command sudo, e.g. \n\
- sudo /bin/bash \n\
- TEAMS WILL USE THE ACCOUNT icpc, WITH PASSWORD\n\
- icpc. THEY MUST NOT KNOW THE PASSWORD YOU\n\
- ARE SETTING UP HERE, WHICH IS A PRIVILEGIED USER.\n\
- If you need to change the password later, you \n\
- must know the current password and use the \n\
- command-line passwd to change it. Do not forget it" --entry --hide-text`
- pass2=`zenity --title="Setting up a icpcadmin password" --text="Re-type it" --entry --hide-text`
- if [ "$pass" == "$pass2" -a "$pass" != "" ]; then
- OK=0
- else
- zenity --info --title="Error" --text="Passwords do not match"
- fi
- done
- pass=\$`/bin/echo -n "$pass2" | /usr/bin/makepasswd --clearfrom - --crypt-md5 | /usr/bin/cut -d'$' -f2-`
- pass2=""
- /usr/sbin/usermod -p "$pass" icpcadmin
- pass=`echo -n icpc | makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-`
- pass=\$`echo $pass`
- /usr/sbin/usermod -p "$pass" icpc
- zenity --info --title="Updated" --text="Password of icpcadmin should be updated\nIf not, login in and change it to something safe"
- else
- zenity --info --title="Update error" --text="User icpcadmin not found -- update your password by yourself."
- fi
- fi
-
- if [ "$BOCASERVER" != "0/0" ]; then
- OK=1
- while [ $OK != 0 ]; do
- pass=`zenity --title="Setting up password of BOCA database" --text="Enter the password of the BOCA database IF AND ONLY IF \n\
-this is NOT a team machine. The password must be entered \n\
-in case this machine will be used for autojudging. \n\
-If you do not enter a password now, it is possible to do \n\
-it later using the command-line /etc/icpc/updatedbpass.sh \n\
-IF THIS IS GOING TO BE USED BY A TEAM, THEN JUST \n\
-PRESS ENTER WITHOUT TYPING ANY PASSWORD\n\
-If this is a server, you may also leave this field empty" --entry --hide-text`
- if [ "$pass" == "" ]; then
- break
- fi
- pass2=`zenity --title="Setting up password of BOCA database" --text="Re-type it" --entry --hide-text`
- if [ "$pass" == "$pass2" -a "$pass" != "" ]; then
- OK=0
- /etc/icpc/updatedbpass.sh "$pass"
- else
- zenity --info --title="Error" --text="Passwords do not match"
- fi
- done
- fi
- touch /etc/icpc/.firsttimedone
- zenity --info --title="Setup completed" --text="The setup is completed. If you want to do it again, you might \n\
-run the command-line /etc/icpc/restart.sh\nbut some files in this computer (e.g. from the icpc user) might be lost."
-fi
-
-if [ -x /etc/network/if-pre-up.d/boca ]; then
- . /etc/network/if-pre-up.d/boca
-fi
-
-exit 0
diff --git a/tools/etc/icpc/update.sh b/tools/etc/icpc/update.sh
deleted file mode 100755
index 78a87bb..0000000
--- a/tools/etc/icpc/update.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-if [ "`id -u`" != "0" ]; then
- echo "Script must run as root"
-fi
-if [ "$1" == "" ]; then
- wget -O /tmp/update.sh "http://www.ime.usp.br/~cassio/boca/download.php?filename=update.sh"
-else
- wget -O /tmp/update.sh "http://www.ime.usp.br/~cassio/boca/download.php?filename=update.$1.sh"
-fi
-chmod 700 /tmp/update.sh 2>/dev/null
-if [ $? != 0 ]; then
- echo "ERROR DOWNLOADING UPDATE"
- exit 1
-fi
-echo ">>>>>>>>>>"
-echo ">>>>>>>>>> Running update script"
-echo ">>>>>>>>>>"
-/tmp/update.sh
-rm -f /tmp/update.sh
-exit $?
diff --git a/tools/etc/icpc/updatedbpass.sh b/tools/etc/icpc/updatedbpass.sh
deleted file mode 100755
index a33be16..0000000
--- a/tools/etc/icpc/updatedbpass.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/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 05/aug/2012 by cassio@ime.usp.br
-privatedir=/var/www/boca/src/private
-
-if [ ! -d $privatedir ]; then
- echo "Could not find directory $privatedir"
- exit 1
-fi
-for i in id chown chmod awk grep cat sed mv; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-if [ "`id -u`" != "0" ]; then
- echo "Script must run as root"
-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
-[ $? != 0 ] && echo "User $apacheuser not found -- error to set permissions with chown/chmod"
-
-BOCASERVER=localhost
-[ -x /etc/icpc/bocaserver.sh ] && . /etc/icpc/bocaserver.sh
-if [ "$BOCASERVER" = "0/0" -o "$BOCASERVER" = "" ]; then
- BOCASERVER=localhost
-fi
-echo "BOCA server is configured to be $BOCASERVER"
-if [ "$1" == "" ]; then
- read -p "DB password: " -s PASS
-else
- zenity --info --title="Server info" --text="BOCA server is configured to be $BOCASERVER"
- PASS=$1
-fi
-PASSK=`makepasswd --chars 20`
-awk -v boca="$BOCASERVER" -v pass="$PASS" -v passk="$PASSK" '{ if(index($0,"[\"dbpass\"]")>0) \
- print "$conf[\"dbpass\"]=\"" pass "\";"; \
- else if(index($0,"[\"dbhost\"]")>0) print "$conf[\"dbhost\"]=\"" boca "\";"; \
- else if(index($0,"[\"dbsuperpass\"]")>0) print "$conf[\"dbsuperpass\"]=\"" pass "\";"; \
- else if(index($0,"[\"key\"]")>0) print "$conf[\"key\"]=\"" passk "\";"; else print $0; }' \
- < $privatedir/conf.php > $privatedir/conf.php1
-mv -f $privatedir/conf.php1 $privatedir/conf.php
-echo "Deny from all" > $privatedir/.htaccess
-chown -R $apacheuser.root $privatedir
-chmod -R u+rw,g+rw,o-rw $privatedir
-echo "passwords updated in $privatedir/conf.php"
-
-postgresuser=postgres
-id -u $postgresuser >/dev/null 2>/dev/null
-if [ $? == 0 -a "$BOCASERVER" == "localhost" ]; then
- echo "trying to update password for user bocauser in the database";
- rm -f /tmp/.boca.tmp
- su - $postgresuser -c "echo select contestnumber from contesttable | psql -d bocadb | grep contestnumber >/tmp/.boca.tmp 2>/tmp/.boca.tmp"
- su - $postgresuser -c "echo drop user bocauser | psql -d template1 >/dev/null 2>/dev/null"
- su - $postgresuser -c "echo create user bocauser createdb password \'$PASS\' | psql -d template1 2>/dev/null"
- su - $postgresuser -c "echo alter user bocauser createdb password \'$PASS\' | psql -d template1"
- su - $postgresuser -c "echo alter user postgres password \'$PASS\' | psql -d template1"
- rm -f /tmp/.boca.tmp
-fi
-
-
-if [ "$1" != "" ]; then
- zenity --info --title="Updated" --text="Password updated in $privatedir/conf.php file"
-fi
diff --git a/tools/etc/network/if-pre-up.d/boca b/tools/etc/network/if-pre-up.d/boca
deleted file mode 100644
index 20ff38f..0000000
--- a/tools/etc/network/if-pre-up.d/boca
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-if [ ! -f /etc/icpc/.isserver ]; then
-if [ -x /etc/icpc/bocaserver.sh ]; then
- . /etc/icpc/bocaserver.sh
-fi
-/sbin/iptables -F INPUT
-/sbin/iptables -A INPUT -i lo -j ACCEPT
-/sbin/iptables -A INPUT -s 143.107.255.15 -j ACCEPT
-
-# just to make things easier, let's allow communication to/from BOCA servers
-/sbin/iptables -A INPUT -s 45.33.30.235 -j ACCEPT
-/sbin/iptables -A INPUT -s 50.116.19.221 -j ACCEPT
-
-if [ "$BOCASERVER" != "" ]; then
- /sbin/iptables -A INPUT -s $BOCASERVER -j ACCEPT
-fi
-if [ "$BOCASERVERS" != "" ]; then
- for i in `echo $BOCASERVERS | tr ';' ' '`; do
- /sbin/iptables -A INPUT -s $i -j ACCEPT
- done
-fi
-/sbin/iptables -A INPUT -m udp -p udp -s 0/0 --sport 67:68 --dport 67:68 -j ACCEPT
-/sbin/iptables -A INPUT -m udp -p udp -s 0/0 --sport 53 --dport 53 -j ACCEPT
-/sbin/iptables -A INPUT -m tcp -p tcp -s 0/0 --sport 53 --dport 53 -j ACCEPT
-/sbin/iptables -A INPUT -j REJECT
-else
- if [ -x /etc/icpc/bocaserver.iptables ]; then
- . /etc/icpc/bocaserver.iptables
- fi
-fi
diff --git a/tools/etc/network/if-up.d/boca b/tools/etc/network/if-up.d/boca
deleted file mode 100644
index 20ff38f..0000000
--- a/tools/etc/network/if-up.d/boca
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-if [ ! -f /etc/icpc/.isserver ]; then
-if [ -x /etc/icpc/bocaserver.sh ]; then
- . /etc/icpc/bocaserver.sh
-fi
-/sbin/iptables -F INPUT
-/sbin/iptables -A INPUT -i lo -j ACCEPT
-/sbin/iptables -A INPUT -s 143.107.255.15 -j ACCEPT
-
-# just to make things easier, let's allow communication to/from BOCA servers
-/sbin/iptables -A INPUT -s 45.33.30.235 -j ACCEPT
-/sbin/iptables -A INPUT -s 50.116.19.221 -j ACCEPT
-
-if [ "$BOCASERVER" != "" ]; then
- /sbin/iptables -A INPUT -s $BOCASERVER -j ACCEPT
-fi
-if [ "$BOCASERVERS" != "" ]; then
- for i in `echo $BOCASERVERS | tr ';' ' '`; do
- /sbin/iptables -A INPUT -s $i -j ACCEPT
- done
-fi
-/sbin/iptables -A INPUT -m udp -p udp -s 0/0 --sport 67:68 --dport 67:68 -j ACCEPT
-/sbin/iptables -A INPUT -m udp -p udp -s 0/0 --sport 53 --dport 53 -j ACCEPT
-/sbin/iptables -A INPUT -m tcp -p tcp -s 0/0 --sport 53 --dport 53 -j ACCEPT
-/sbin/iptables -A INPUT -j REJECT
-else
- if [ -x /etc/icpc/bocaserver.iptables ]; then
- . /etc/icpc/bocaserver.iptables
- fi
-fi
diff --git a/tools/etc/rc.local b/tools/etc/rc.local
deleted file mode 100755
index d6e943b..0000000
--- a/tools/etc/rc.local
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-#
-# rc.local
-#
-# This script is executed at the end of each multiuser runlevel.
-# Make sure that the script will "exit 0" on success or any other
-# value on error.
-#
-# In order to enable or disable this script just change the execution
-# bits.
-#
-# By default this script does nothing.
-
-if [ -x /etc/icpc/doclean.sh ]; then
- /etc/icpc/doclean.sh
-fi
-
-grep -iq "iface.*eth0" /etc/network/interfaces
-if [ $? != 0 ]; then
- echo "auto eth0" >> /etc/network/interfaces
- echo "iface eth0 inet dhcp" >> /etc/network/interfaces
-fi
-
-grep -q "50.116.19.221.*www.bombonera.org.*www.bombonera.org" /etc/hosts
-if [ $? != 0 ]; then
- echo "50.116.19.221 www.bombonera.org www.bombonera.org" >> /etc/hosts
-fi
-grep -q "143.107.45.22.*www.ime.usp.br.*www.ime.usp.br" /etc/hosts
-if [ $? != 0 ]; then
- echo "143.107.45.22 www.ime.usp.br www.ime.usp.br" >> /etc/hosts
-fi
-
-ntpdate -u 198.60.22.240
-ntpdate -u 104.232.3.3
-exit 0
diff --git a/tools/etc/sysctl.d/10-shmmax.conf b/tools/etc/sysctl.d/10-shmmax.conf
deleted file mode 100644
index b645ff6..0000000
--- a/tools/etc/sysctl.d/10-shmmax.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-kernel.shmmax = 805416960
-kernel.shmall = 196635
diff --git a/tools/etc/sysctl.d/10-vm-swappiness.conf b/tools/etc/sysctl.d/10-vm-swappiness.conf
deleted file mode 100644
index c062945..0000000
--- a/tools/etc/sysctl.d/10-vm-swappiness.conf
+++ /dev/null
@@ -1 +0,0 @@
-vm.swappiness=20
diff --git a/tools/genpackage.sh b/tools/genpackage.sh
deleted file mode 100755
index dd4932f..0000000
--- a/tools/genpackage.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-# ////////////////////////////////////////////////////////////////////////////////
-# //BOCA Online Contest Administrator
-# // Copyright (C) 2003- 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 03/sep/2014 by cassio@ime.usp.br
-cdir=`pwd`
-bocadir=$(dirname $cdir)
-basen=`basename $cdir`
-if [ ! -f "$cdir/genpackage.sh" -o "$basen" != "tools" ]; then
- echo "Please run this script from its own directory in tools/ of the BOCA directory"
-else
-if [ "$1" == "" ]; then
- ver=$(basename $(dirname $cdir) | cut -d'-' -f2-)
-else
- ver=$1
-fi
-echo "*** Processing version $ver"
-cd /tmp
-cp -a $bocadir boca-$ver
-rm -rf /tmp/boca-$ver/.git
-rm -f /tmp/boca-$ver/tools/boca-*.tgz
-if [ "$ver" != "" -a -d "boca-$ver" ]; then
-echo "boca-$ver" > boca-$ver/src/version
-echo -e "<?php\n\$BOCAVERSION='boca-$ver';\n\$YEAR='2015';\n?>\n" > boca-$ver/src/versionnum.php
-touch boca-$ver/src/private/runtmp/run0.php boca-$ver/src/private/scoretmp/0.php boca-$ver/src/private/remotescores/0.dat \
- boca-$ver/src/private/remotescores/0.tmp boca-$ver/src/private/problemtmp/problem0.tmp
-rm -f boca-$ver/src/balloons/*.png
-rm -f boca-$ver/src/private/runtmp/run*.php boca-$ver/src/private/scoretmp/*.php boca-$ver/src/private/remotescores/*.dat \
- boca-$ver/src/private/remotescores/*.tmp
-rm -rf boca-$ver/src/private/problemtmp/problem*
-touch boca-$ver/.temp
-rm boca-$ver/.temp `find boca-$ver/ -name "*.orig"`
-touch boca-$ver/.temp
-rm boca-$ver/.temp `find boca-$ver/ -name "*~"`
-touch boca-$ver/.temp
-rm boca-$ver/.temp `find boca-$ver/ -name ".\#*"`
-touch boca-$ver/.temp
-rm boca-$ver/.temp `find boca-$ver/ -name ".DS*"`
-touch boca-$ver/.temp
-rm boca-$ver/.temp `find boca-$ver/ -name "._*"`
-cd boca-$ver/tools/etc
-tar czf ../icpc.etc.tgz *
-cd ../../..
-COPYFILE_DISABLE=1 tar czf $cdir/boca-$ver.tgz boca-$ver/
-rm -rf /tmp/boca-$ver
-echo "*** file generated: $cdir/boca-$ver.tgz"
-else
- echo "*** boca-$ver not found"
-fi
-fi
-cd $cdir
diff --git a/tools/getrunlist.sh b/tools/getrunlist.sh
deleted file mode 100644
index 0592321..0000000
--- a/tools/getrunlist.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/bash
-
-if [ "$2" == "" ]; then
- echo "Usage: getrunlist.sh USER PASSWORD DIR"
- exit 1
-fi
-BOCASERVER=45.33.30.235
-user=$1
-pass=$2
-dir=$3
-if [ "$dir" == "" ]; then
- dir=/root
-fi
-
-for i in uuencode wget tr sha256sum cut; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo "$i" not found
- exit 1
- fi
-done
-
-while /bin/true; do
- tt=`date +%s-%N`
-temp=/tmp/.temp.$tt.txt
-md=`wget -t 2 -T 5 -S http://$BOCASERVER/boca/index.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
-echo "$md" | grep -q PHPSESS
-if [ "$?" == "0" ]; then
- md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
- res=`echo -n $pass | sha256sum - | cut -f1 -d' '`
- res=`echo -n "${res}${md}" | sha256sum - | cut -f1 -d' '`
- wget -t 2 -T 5 "http://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
- grep -qi incorrect $temp
- if [ $? == 0 ]; then
- echo "$BOCASERVER: User or password incorrect"
- rm -f $temp
- rm -f ${temp}.cookie.txt
- exit 3
- else
- wget -t 2 -T 5 "http://$BOCASERVER/boca/staff/run.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies -O $dir/runlist.$tt.html >/dev/null 2>/dev/null
- rm -f ${temp}.out
- grep -q "Run List" $dir/runlist.$tt.html
- if [ "$?" == "0" ]; then
- echo "FILE $dir/runlist.$tt.html DOWNLOADED"
- else
- echo "ERROR TO DOWNLOAD $dir/runlist.$tt.html"
- fi
- fi
- [ -f "$temp" ] && rm -f "$temp"
- rm -f ${temp}.cookie.txt 2>/dev/null
-else
- echo "COULD NOT REACH THE GLOBAL SERVER"
-fi
-sleep 60
-done
diff --git a/tools/icpc.etc.tgz b/tools/icpc.etc.tgz
deleted file mode 100644
index e58e2b1..0000000
--- a/tools/icpc.etc.tgz
+++ /dev/null
Binary files differ
diff --git a/tools/install_12_04.sh b/tools/install_12_04.sh
deleted file mode 100755
index e7a7474..0000000
--- a/tools/install_12_04.sh
+++ /dev/null
@@ -1,405 +0,0 @@
-#!/bin/bash
-# ////////////////////////////////////////////////////////////////////////////////
-# //BOCA Online Contest Administrator
-# // Copyright (C) 2003-2014 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/>.
-# ////////////////////////////////////////////////////////////////////////////////
-# // modified 30/Oct/2014 by cassio@ime.usp.br
-# // inclusion of extra warning about losing your own files
-# // modified 27/Oct/2014 by cassio@ime.usp.br
-# // inclusion of gcc-4.8 and update to Java 7
-#///////////////////////////////////////////////////////////////////////////////////////////
-echo "#############################################################"
-echo "### installv2.sh of 30/Oct/2014 (A) by cassio@ime.usp.br ###"
-echo "#############################################################"
-
-echo "###"
-echo "####"
-echo "##### NEVER RUN installv2.sh in a computer that is not a FRESH ubuntu (you might lose stuff)"
-echo "####"
-echo "### press control-C to stop now or enter to proceed"
-read lin
-
-if [ "`id -u`" != "0" ]; then
- echo "Must be run as root"
- exit 1
-fi
-
-apt-get -y install python-software-properties 2>/dev/null
-apt-get -y install software-properties-common 2>/dev/null
-#apt-get -y install virtualbox-guest-utils virtualbox-guest-dkms 2>/dev/null
-#apt-get -y install virtualbox-guest-x11 2>/dev/null
-
-for i in id chown chmod cut awk tail grep cat sed mkdir rm mv sleep apt-get add-apt-repository update-alternatives; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-sleep 2
-
-echo "$0" | grep -q "install.*sh"
-if [ $? != 0 ]; then
- echo "Make the install script executable (using chmod) and run it directly, like ./installv2.sh"
-else
-
-if [ "$1" != "alreadydone" ]; then
- echo "It is recommended that you run the commands"
- echo " apt-get update; apt-get upgrade"
- echo "by your own before running this script. If you have already done it,"
- echo "please run the script as"
- echo " ./install.sh alreadydone"
- exit 1
-fi
-
-if [ ! -r /etc/lsb-release ]; then
- echo "File /etc/lsb-release not found. Is this a ubuntu or debian-like distro?"
- exit 1
-fi
-. /etc/lsb-release
-
-echo "============================================================="
-echo "============== DISABLING AUTO-UPDATE POP-UPS ==============="
-echo "============================================================="
-gconftool -s --type bool /apps/update-notifier/auto_launch false
-gsettings set com.ubuntu.update-notifier no-show-notifications true
-sed -i 's/X-GNOME-Autostart-Delay=60/X-GNOME-Autostart-enabled=false/' /etc/xdg/autostart/update-notifier.desktop
-
-echo "============================================================="
-echo "========= UNINSTALLING SOME UNNECESSARY PACKAGES ==========="
-echo "============================================================="
-apt-get -y purge libreoffice-common libreoffice-base-core
-apt-get -y purge bluez thunderbird
-apt-get -y purge unity-lens-shopping
-apt-get -y purge unity-webapps-common
-apt-get -y purge ubuntuone-client python-ubuntuone-client ubuntuone-installer python-ubuntuone-storageprotocol
-
-echo "========= INSTALLING SYSVINIT-UTILS ==========="
-apt-get -y install sysvinit-utils
-if [ $? != 0 ]; then
- apt-get -y install sysvutils
- if [ $? != 0 ]; then
- echo ""
- echo "ERROR running the apt-get -- must check if all needed packages are available"
- exit 1
- fi
-fi
-
-echo "=============================================================="
-echo "============== CHECKING FOR OTHER APT SERVERS ==============="
-echo "=============================================================="
-echo "============== CHECKING FOR canonical.com APT SERVER ========"
-cd
-grep -q "^[^\#]*deb http://archive.canonical.com.* $DISTRIB_CODENAME .*partner" /etc/apt/sources.list
-if [ $? != 0 ]; then
- add-apt-repository "deb http://archive.canonical.com/ubuntu $DISTRIB_CODENAME partner"
-fi
-echo "=============================================================="
-echo "============== ADDING extra rep for C++11 ===================="
-add-apt-repository ppa:ubuntu-toolchain-r/test
-
-apt-get -y update
-apt-get -y upgrade
-
-libCppdev=`apt-cache search libstdc++ | grep "libstdc++6-.*-dev " | sort | tail -n1 | cut -d' ' -f1`
-if [ "$libCppdev" == "" ]; then
- echo "libstdc++6-*-dev not found"
- exit 1
-fi
-libCppdbg=`apt-cache search libstdc++ | grep "libstdc++6-.*-dbg " | sort | tail -n1 | cut -d' ' -f1`
-if [ "$libCppdbg" == "" ]; then
- echo "libstdc++6-*-dbg not found"
- exit 1
-fi
-libCppdoc=`apt-cache search libstdc++ | grep "libstdc++6-.*-doc " | sort | tail -n1 | cut -d' ' -f1`
-if [ "$libCppdoc" == "" ]; then
- echo "libstdc++6-*-doc not found"
- exit 1
-fi
-geanydeb=`apt-cache search geany-plugin-gdb`
-if [ "$geanydeb" == "" ]; then
- geanydeb=debugger
-else
- geanydeb=gdb
-fi
-
-echo "====================================================================="
-echo "================= installing packages needed by BOCA ==============="
-echo "====================================================================="
-
-apt-get -y install zenity apache2 eclipse-pde eclipse-rcp eclipse-platform eclipse-jdt eclipse-cdt eclipse emacs \
- evince g++ gcc gedit scite libstdc++6 makepasswd manpages-dev php5-cli php5-mcrypt openjdk-7-dbg openjdk-7-jdk \
- php5 php5-pgsql postgresql postgresql-client postgresql-contrib quota sharutils default-jdk openjdk-7-doc \
- vim-gnome geany geany-plugin-addons geany-plugins geany-plugin-${geanydeb} default-jre sysstat \
- vim xfce4 $libCppdev $libCppdoc $libCppdbg php5-gd stl-manual gcc-doc debootstrap schroot c++-annotations
-if [ $? != 0 ]; then
- echo ""
- echo "ERROR running the apt-get -- must check if all needed packages are available"
- exit 1
-fi
-apt-get -y install gcc-4.8 g++-4.8
-if [ $? != 0 ]; then
- echo ""
- echo "ERROR running the apt-get for gcc 4.8 -- must check if all needed packages are available"
- exit 1
-fi
-update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
-update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
-
-update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-6-openjdk-*/jre/bin/java 10
-update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-6-openjdk-*/bin/javac 10
-update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/java-6-openjdk-*/bin/javadoc 10
-update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java-6-openjdk-*/bin/javap 10
-update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java-6-openjdk-*/bin/javah 10
-
-apt-get -y autoremove
-apt-get -y clean
-
-for i in makepasswd useradd update-rc.d; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-
-
-echo "=================================================================="
-echo "============= creating user icpc with password icpc ============="
-echo "=================================================================="
-
-mkdir -p /etc/skel/Desktop/
-cat <<EOF > /etc/skel/Desktop/javadoc.desktop
-[Desktop Entry]
-Version=1.5.1
-Name=Java API
-Comment=Java API
-Exec=firefox /usr/share/doc/openjdk-7-jre-headless/api/index.html
-Terminal=false
-Type=Application
-EOF
-cat <<EOF > /etc/skel/Desktop/stldoc.desktop
-[Desktop Entry]
-Version=1.5.1
-Name=C++ STL
-Comment=C++ STL
-Exec=firefox /usr/share/doc/stl-manual/html/index.html
-Terminal=false
-Type=Application
-EOF
-cat <<EOF > /etc/skel/Desktop/cppannotations.desktop
-[Desktop Entry]
-Version=1.5.1
-Name=C++ Annotations
-Comment=C++ Annotations
-Exec=firefox /usr/share/doc/c++-annotations/html/index.html
-Terminal=false
-Type=Application
-EOF
-[ -f /usr/share/applications/eclipse.desktop ] && cp /usr/share/applications/eclipse.desktop /etc/skel/Desktop/
-[ -f /usr/share/applications/gedit.desktop ] && cp /usr/share/applications/gedit.desktop /etc/skel/Desktop/
-[ -f /usr/share/applications/emacs23.desktop ] && cp /usr/share/applications/emacs23.desktop /etc/skel/Desktop/
-[ -f /usr/share/applications/emacs24.desktop ] && cp /usr/share/applications/emacs24.desktop /etc/skel/Desktop/
-cp /usr/share/applications/gnome-terminal.desktop /etc/skel/Desktop/
-chmod 755 /etc/skel/Desktop/*.desktop
-
-pass=`echo -n icpc | makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-`
-pass=\$`echo $pass`
-id -u icpc >/dev/null 2>/dev/null
-if [ $? != 0 ]; then
- useradd -d /home/icpc -k /etc/skel -m -p "$pass" -s /bin/bash -g users icpc
-else
- usermod -d /home/icpc -p "$pass" -s /bin/bash -g users icpc
- echo "user icpc already exists"
-fi
-
-if [ -f /etc/lightdm/lightdm.conf ]; then
- echo "=============================================================="
- echo "============ disabling guest account on lightdm.conf ========"
- echo "=============================================================="
- grep -q "^[^\#]*allow-guest" /etc/lightdm/lightdm.conf
- if [ $? != 0 ]; then
- echo "allow-guest=false" >> /etc/lightdm/lightdm.conf
- fi
- grep -q "^[^\#]*greeter-hide-users" /etc/lightdm/lightdm.conf
- if [ $? != 0 ]; then
- echo "greeter-hide-users=true" >> /etc/lightdm/lightdm.conf
- fi
-fi
-
-echo "====================================================================================="
-echo "============ updating grub boot loader to make it password protected ==============="
-echo "====================================================================================="
-
-grep -q "^[^\#]*password" /etc/grub.d/40_custom
-if [ $? != 0 ]; then
- echo "updated with new password (if needed, see the password at /etc/grub.d/40_custom)"
- echo -e "set superusers=\"root\"" >> /etc/grub.d/40_custom
- echo -e "password root `makepasswd`" >> /etc/grub.d/40_custom
- chmod go-rw /etc/grub.d/40_custom
- grub-mkconfig > /boot/grub/grub.cfg
- chmod go-rw /boot/grub/grub.cfg
-fi
-echo "grub loader configured with password (if needed, see the password at /etc/grub.d/40_custom)"
-
-echo "=============================================================="
-echo "============= INSTALLING SCRIPTS at /etc/icpc ==============="
-echo "=============================================================="
-mkdir -p /etc/icpc
-chown root.root /etc/icpc
-chmod 755 /etc/icpc
-cat <<EOF > /etc/icpc/installscripts.sh
-#!/bin/bash
-echo "================================================================================"
-echo "========== downloading config files from www.ime.usp.br/~cassio/boca =========="
-echo "================================================================================"
-iptables -F
-wget -O /tmp/.boca.tmp "http://www.ime.usp.br/~cassio/boca/icpc.etc.date.txt"
-echo ">>>>>>>>>>"
-echo ">>>>>>>>>> Downloading scripts release \`cat /tmp/.boca.tmp\`"
-echo ">>>>>>>>>>"
-
-if [ "\$1" == "" ]; then
-wget -O /tmp/.boca.tmp "http://www.ime.usp.br/~cassio/boca/icpc.etc.ver.txt"
-icpcver=\`cat /tmp/.boca.tmp\`
-else
-icpcver=\$1
-fi
-echo "Looking for version \$icpcver from http://www.ime.usp.br/~cassio/boca/"
-
-rm -f /tmp/icpc.etc.tgz
-wget -O /tmp/icpc.etc.tgz "http://www.ime.usp.br/~cassio/boca/download.php?filename=icpc-\$icpcver.etc.tgz"
-if [ "\$?" != "0" -o ! -f /tmp/icpc.etc.tgz ]; then
- echo "ERROR downloading file icpc-\$icpcver.etc.tgz. Aborting *****************"
- exit 1
-fi
-grep -qi "bad parameters" /tmp/icpc.etc.tgz
-if [ "\$?" == "0" ]; then
- echo "ERROR downloading file icpc-\$icpcver.etc.tgz. Aborting *****************"
- exit 1
-fi
-
-cd /etc
-di=\`date +%s\`
-
-echo "=============================================================="
-echo "====================== BACKUPING CONFIG FILES ==============="
-
-for i in \`tar tvzf /tmp/icpc.etc.tgz | awk '{ print \$6; }'\`; do
- if [ -f "\$i" ]; then
- bn=\`basename \$i\`
- dn=\`dirname \$i\`
- mv \$i \$dn/.\$bn.bkp.\$di
- chmod 600 \$dn/.\$bn.bkp.\$di
- fi
-done
-
-echo "=============================================================="
-echo "====================== EXTRACTING CONFIG FILES ==============="
-tar -xkvzf /tmp/icpc.etc.tgz
-for i in \`tar tvzf /tmp/icpc.etc.tgz | awk '{ print \$6; }'\`; do
- chown root.root \$i
- chmod o-w,u+rx \$i
-done
-EOF
-chmod 750 /etc/icpc/installscripts.sh
-/etc/icpc/installscripts.sh $3
-
-service procps start
-
-grep -q "quota" /etc/fstab
-if [ $? != 0 ]; then
- cp -f /etc/fstab /etc/fstab.bkp.$di
- sed "s/relatime/quota,relatime/" < /etc/fstab.bkp.$di > /etc/fstab.bkp.$di.1
- sed "s/errors=remount-ro/quota,errors=remount-ro/" < /etc/fstab.bkp.$di.1 > /etc/fstab
-fi
-
-echo "============================================================"
-echo "===================== SETTING UP USER QUOTA ==============="
-echo "============================================================"
-
-for i in `mount | grep gvfs | cut -d' ' -f3`; do
- umount $i
-done
-
-mount / -o remount
-quotaoff -a 2>/dev/null
-quotacheck -M -a
-quotaon -a
-setquota -u postgres 0 3000000 0 10000 -a
-setquota -u icpc 0 500000 0 10000 -a
-setquota -u nobody 0 500000 0 10000 -a
-setquota -u www-data 0 1500000 0 10000 -a
-
-echo "=============================================================="
-echo "================= UPDATING rc.local symlinks ==============="
-echo "=============================================================="
-
-update-rc.d rc.local defaults
-update-rc.d -f cups remove
-apt-get -y clean
-
-#echo "=============================================================="
-#echo "====================== SETTING UP IPs and PASSWORDs (server config follows) ==============="
-#
-/etc/icpc/restart.sh
-#/etc/icpc/setup.sh
-
-startscript="NOTOK"
-if [ -f /etc/lightdm/lightdm.conf ]; then
- startscript="OK"
- grep -q "^[^\#]*display-setup-script=/etc/icpc/setup.sh" /etc/lightdm/lightdm.conf
- if [ $? != 0 ]; then
- echo "display-setup-script=/etc/icpc/setup.sh" >> /etc/lightdm/lightdm.conf
- fi
-fi
-if [ -d /etc/gdm/Init ]; then
- startscript="OK"
- echo "======================================================================================"
- echo "========== UPDATING /etc/gdm/Init/Default TO PROVIDE CONFIG AT STARTUP ==============="
- echo "======================================================================================"
- echo -e "#!/bin/bash\n[ -x /etc/icpc/setup.sh ] && /etc/icpc/setup.sh\n\n" > /tmp/.boca.tmp
- cat /etc/gdm/Init/Default >> /tmp/.boca.tmp
- mv /tmp/.boca.tmp /etc/gdm/Init/Default
- chmod 755 /etc/gdm/Init/Default
-fi
-if [ "$startscript" != "OK" ]; then
- echo "************ STARTUP CALL OF SCRIPTS NOT CONFIGURED **************"
- echo "****** neither /etc/gdm/Init nor /etc/lightdm/lightdm.conf were found ************"
-fi
-
-if [ -f /etc/icpc/createbocajail.sh ]; then
- chmod 750 /etc/icpc/createbocajail.sh
- if [ "$2" != "notbuildjail" ]; then
- /etc/icpc/createbocajail.sh
- fi
-else
- echo "************** SCRIPT TO CREATE BOCAJAIL NOT FOUND -- SOMETHING LOOKS WRONG ***************"
-fi
-
-# BOCA CONFIG
-if [ -f /etc/icpc/installboca.sh ]; then
- chmod 750 /etc/icpc/installboca.sh
- /sbin/iptables -F
- /etc/icpc/installboca.sh "$3" "$4"
-else
- echo "************* SCRIPT TO INSTALL BOCA NOT FOUND -- SOMETHING IS WRONG -- I CANT INSTALL BOCA **************"
-fi
-
-fi
diff --git a/tools/installv2.sh b/tools/installv2.sh
deleted file mode 100755
index 5b756da..0000000
--- a/tools/installv2.sh
+++ /dev/null
@@ -1,373 +0,0 @@
-#!/bin/bash
-# ////////////////////////////////////////////////////////////////////////////////
-# //BOCA Online Contest Administrator
-# // Copyright (C) 2003-2014 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 26/Aug/2015 by cassio@ime.usp.br
-#///////////////////////////////////////////////////////////////////////////////////////////
-echo "#############################################################"
-echo "### $0 by cassio@ime.usp.br for Ubuntu 14.04.3 ###"
-echo "#############################################################"
-
-if [ "`id -u`" != "0" ]; then
- echo "Must be run as root"
- exit 1
-fi
-
-## REMOVE NOTIFICATIONS
-# killall update-notifier
-# if [ ! -f /usr/bin/update-notifier.orig ]; then
-# mv /usr/bin/update-notifier /usr/bin/update-notifier.orig
-# fi
-# echo "#!/bin/bash" >/usr/bin/update-notifier
-# find /usr/lib -name notify-osd | xargs chmod -x
-# killall notify-osd 2>/dev/null
-apt-get -y install python-software-properties 2>/dev/null
-
-for i in id chown chmod cut awk tail grep cat sed mkdir rm mv sleep apt-get add-apt-repository update-alternatives; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-sleep 2
-
-echo "$0" | grep -q "install.*sh"
-if [ $? != 0 ]; then
- echo "Make the install script executable (using chmod) and run it directly, like ./install.sh"
-else
-
-if [ "$1" != "alreadydone" ]; then
- echo "It is recommended that you run the commands"
- echo " apt-get update; apt-get upgrade"
- echo "by your own before running this script. If you have already done it,"
- echo "please run the script as"
- echo " ./install.sh alreadydone"
- exit 1
-fi
-
-if [ ! -r /etc/lsb-release ]; then
- echo "File /etc/lsb-release not found. Is this a ubuntu or debian-like distro?"
- exit 1
-fi
-. /etc/lsb-release
-
-echo "============================================================="
-echo "========= UNINSTALLING SOME UNNECESSARY PACKAGES ==========="
-echo "============================================================="
-apt-get -y purge libreoffice-common libreoffice-base-core
-apt-get -y purge thunderbird
-apt-get -y purge unity-lens-shopping
-apt-get -y purge unity-webapps-common
-apt-get -y install sysvinit-utils
-gsettings set com.canonical.Unity.Lenses disabled-scopes "['more_suggestions-amazon.scope', 'more_suggestions-u1ms.scope', 'more_suggestions-populartracks.scope', 'music-musicstore.scope', 'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope', 'more_suggestions-skimlinks.scope']" >/dev/null 2>&1
-apt-get -y autoremove
-
-echo "=============================================================="
-echo "============== CHECKING FOR OTHER APT SERVERS ==============="
-echo "=============================================================="
-echo "============== CHECKING FOR canonical.com APT SERVER ========"
-cd
-grep -q "^[^\#]*deb http://archive.canonical.com.* $DISTRIB_CODENAME .*partner" /etc/apt/sources.list
-if [ $? != 0 ]; then
- add-apt-repository "deb http://archive.canonical.com/ubuntu $DISTRIB_CODENAME partner"
-fi
-apt-add-repository -y ppa:webupd8team/sublime-text-3
-
-apt-get -y update
-apt-get -y upgrade
-
-libCppdev=`apt-cache search libstdc++ | grep "libstdc++6-.*-dev " | sort | tail -n1 | cut -d' ' -f1`
-if [ "$libCppdev" == "" ]; then
- echo "libstdc++6-*-dev not found"
- exit 1
-fi
-libCppdbg=`apt-cache search libstdc++ | grep "libstdc++6-.*-dbg " | sort | tail -n1 | cut -d' ' -f1`
-if [ "$libCppdbg" == "" ]; then
- echo "libstdc++6-*-dbg not found"
- exit 1
-fi
-libCppdoc=`apt-cache search libstdc++ | grep "libstdc++6-.*-doc " | sort | tail -n1 | cut -d' ' -f1`
-if [ "$libCppdoc" == "" ]; then
- echo "libstdc++6-*-doc not found"
- exit 1
-fi
-
-echo "====================================================================="
-echo "================= installing packages needed by BOCA ==============="
-echo "====================================================================="
-
-apt-get -y install zenity apache2 eclipse-pde eclipse-rcp eclipse-platform eclipse-jdt eclipse-cdt eclipse emacs \
- evince g++ gcc gedit scite libstdc++6 makepasswd manpages-dev php5-cli php5-mcrypt openjdk-7-dbg openjdk-7-jdk \
- php5 php5-pgsql postgresql postgresql-client postgresql-contrib quota sharutils default-jdk openjdk-7-doc \
- vim-gnome geany geany-plugin-addons geany-plugins geany-plugin-debugger default-jre sysstat \
- vim xfce4 $libCppdev $libCppdoc $libCppdbg php5-gd stl-manual gcc-doc debootstrap schroot c++-annotations \
- sublime-text-installer libgnomekbd-common
-if [ $? != 0 ]; then
- echo ""
- echo "ERROR running the apt-get -- must check if all needed packages are available"
- exit 1
-fi
-apt-get -y autoremove
-apt-get -y clean
-
-for i in makepasswd useradd update-rc.d; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-
-
-echo "=================================================================="
-echo "============= creating user icpc with password icpc ============="
-echo "=================================================================="
-
-mkdir -p /etc/skel/Desktop/
-cat <<EOF > /etc/skel/Desktop/javadoc.desktop
-[Desktop Entry]
-Version=1
-Name=Java API
-Comment=Java API
-Exec=firefox /usr/share/doc/openjdk-7-jre-headless/api/index.html
-Terminal=false
-Type=Application
-EOF
-cat <<EOF > /etc/skel/Desktop/stldoc.desktop
-[Desktop Entry]
-Version=1
-Name=C++ STL
-Comment=C++ STL
-Exec=firefox /usr/share/doc/stl-manual/html/index.html
-Terminal=false
-Type=Application
-EOF
-cat <<EOF > /etc/skel/Desktop/cppannotations.desktop
-[Desktop Entry]
-Version=1
-Name=C++ Annotations
-Comment=C++ Annotations
-Exec=firefox /usr/share/doc/c++-annotations/html/index.html
-Terminal=false
-Type=Application
-EOF
-[ -f /usr/share/applications/eclipse.desktop ] && cp /usr/share/applications/eclipse.desktop /etc/skel/Desktop/
-[ -f /usr/share/applications/gedit.desktop ] && cp /usr/share/applications/gedit.desktop /etc/skel/Desktop/
-[ -f /usr/share/applications/emacs23.desktop ] && cp /usr/share/applications/emacs23.desktop /etc/skel/Desktop/
-[ -f /usr/share/applications/emacs24.desktop ] && cp /usr/share/applications/emacs24.desktop /etc/skel/Desktop/
-cp /usr/share/applications/gnome-terminal.desktop /etc/skel/Desktop/
-chmod 755 /etc/skel/Desktop/*.desktop
-
-if [ "`which gconftool`" != "" ]; then
- su - icpcadmin -c "gconftool -s -t bool /apps/update-notifier/auto_launch false"
- su - icpc -c "gconftool -s -t bool /apps/update-notifier/auto_launch false"
-fi
-
-grep -q icpcadmin /etc/ssh/sshd_config
-if [ "$?" != "0" ]; then
- echo "DenyUsers icpc icpcadmin" >> /etc/ssh/sshd_config
- ps auxw |grep sshd|grep -vq grep
- if [ "$?" == "0" ]; then
- service ssh reload
- fi
-fi
-
-pass=`echo -n icpc | makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-`
-pass=\$`echo $pass`
-id -u icpc >/dev/null 2>/dev/null
-if [ $? != 0 ]; then
- useradd -d /home/icpc -k /etc/skel -m -p "$pass" -s /bin/bash -g users icpc
-else
- usermod -d /home/icpc -p "$pass" -s /bin/bash -g users icpc
- echo "user icpc already exists"
-fi
-
-lightdmfile=/etc/lightdm/lightdm.conf
-if [ -d "`dirname $lightdmfile`" ]; then
- echo "=============================================================="
- echo "====== disabling guest account on lightdm ========"
- echo "=============================================================="
- echo -e "[SeatDefaults]\n" > $lightdmfile
- echo -e "allow-guest=false\ngreeter-hide-users=true\ngreeter-show-remote-login=false\ngreeter-show-manual-login=true\n" >> $lightdmfile
-fi
-
-# echo "====================================================================================="
-# echo "============ updating grub boot loader to make it password protected ==============="
-# echo "====================================================================================="
-
-# grep -q "^[^\#]*password" /etc/grub.d/40_custom
-# if [ $? != 0 ]; then
-# echo "updated with new password (if needed, see the password at /etc/grub.d/40_custom)"
-# echo -e "set superusers=\"root\"" >> /etc/grub.d/40_custom
-# echo -e "password root `makepasswd`" >> /etc/grub.d/40_custom
-# chmod go-rw /etc/grub.d/40_custom
-# grub-mkconfig > /boot/grub/grub.cfg
-# chmod go-rw /boot/grub/grub.cfg
-# fi
-# echo "grub loader configured with password (if needed, see the password at /etc/grub.d/40_custom)"
-
-
-
-echo "=============================================================="
-echo "============= INSTALLING SCRIPTS at /etc/icpc ==============="
-echo "=============================================================="
-mkdir -p /etc/icpc
-chown root.root /etc/icpc
-chmod 755 /etc/icpc
-cat <<EOF > /etc/icpc/installscripts.sh
-#!/bin/bash
-echo "================================================================================"
-echo "========== downloading config files from www.ime.usp.br/~cassio/boca =========="
-echo "================================================================================"
-iptables -F
-wget -O /tmp/.boca.tmp "http://www.ime.usp.br/~cassio/boca/icpc.etc.date.txt"
-echo ">>>>>>>>>>"
-echo ">>>>>>>>>> Downloading scripts release \`cat /tmp/.boca.tmp\`"
-echo ">>>>>>>>>>"
-
-if [ "\$1" == "" ]; then
-wget -O /tmp/.boca.tmp "http://www.ime.usp.br/~cassio/boca/icpc.etc.ver.txt"
-icpcver=\`cat /tmp/.boca.tmp\`
-else
-icpcver=\$1
-fi
-echo "Looking for version \$icpcver from http://www.ime.usp.br/~cassio/boca/"
-
-rm -f /tmp/icpc.etc.tgz
-wget -O /tmp/icpc.etc.tgz "http://www.ime.usp.br/~cassio/boca/download.php?filename=icpc-\$icpcver.etc.tgz"
-if [ "\$?" != "0" -o ! -f /tmp/icpc.etc.tgz ]; then
- echo "ERROR downloading file icpc-\$icpcver.etc.tgz. Aborting *****************"
- exit 1
-fi
-grep -qi "bad parameters" /tmp/icpc.etc.tgz
-if [ "\$?" == "0" ]; then
- echo "ERROR downloading file icpc-\$icpcver.etc.tgz. Aborting *****************"
- exit 1
-fi
-
-cd /etc
-di=\`date +%s\`
-
-echo "=============================================================="
-echo "====================== BACKUPING CONFIG FILES ==============="
-
-for i in \`tar tvzf /tmp/icpc.etc.tgz | awk '{ print \$6; }'\`; do
- if [ -f "\$i" ]; then
- bn=\`basename \$i\`
- dn=\`dirname \$i\`
- mv \$i \$dn/.\$bn.bkp.\$di
- chmod 600 \$dn/.\$bn.bkp.\$di
- fi
-done
-
-echo "=============================================================="
-echo "====================== EXTRACTING CONFIG FILES ==============="
-tar -xkvzf /tmp/icpc.etc.tgz
-for i in \`tar tvzf /tmp/icpc.etc.tgz | awk '{ print \$6; }'\`; do
- chown root.root \$i
- chmod o-w,u+rx \$i
-done
-EOF
-chmod 750 /etc/icpc/installscripts.sh
-/etc/icpc/installscripts.sh $3
-
-service procps start
-
-grep -q "quota" /etc/fstab
-if [ $? != 0 ]; then
- cp -f /etc/fstab /etc/fstab.bkp.$di
- sed "s/relatime/quota,relatime/" < /etc/fstab.bkp.$di > /etc/fstab.bkp.$di.1
- sed "s/errors=remount-ro/quota,errors=remount-ro/" < /etc/fstab.bkp.$di.1 > /etc/fstab
-fi
-
-echo "============================================================"
-echo "===================== SETTING UP USER QUOTA ==============="
-echo "============================================================"
-
-for i in `mount | grep gvfs | cut -d' ' -f3`; do
- umount $i
-done
-
-mount / -o remount
-quotaoff -a 2>/dev/null
-quotacheck -M -a
-quotaon -a
-setquota -u postgres 0 3000000 0 10000 -a
-setquota -u icpc 0 500000 0 10000 -a
-setquota -u nobody 0 500000 0 10000 -a
-setquota -u www-data 0 1500000 0 10000 -a
-
-echo "=============================================================="
-echo "================= UPDATING rc.local symlinks ==============="
-echo "=============================================================="
-
-#update-rc.d rc.local defaults
-update-rc.d -f cups remove
-apt-get -y clean
-
-#echo "=============================================================="
-#echo "====================== SETTING UP IPs and PASSWORDs (server config follows) ==============="
-#
-/etc/icpc/restart.sh
-#/etc/icpc/setup.sh
-
-startscript="NOTOK"
-if [ -d "`dirname $lightdmfile`" ]; then
- startscript="OK"
- [ -f $lightdmfile ] && grep -q "^[^\#]*greeter-setup-script=/etc/icpc/setup.sh" $lightdmfile
- if [ $? != 0 ]; then
- echo "greeter-setup-script=/etc/icpc/setup.sh" >> $lightdmfile
- fi
-fi
-if [ -d /etc/gdm/Init ]; then
- startscript="OK"
- echo "======================================================================================"
- echo "========== UPDATING /etc/gdm/Init/Default TO PROVIDE CONFIG AT STARTUP ==============="
- echo "======================================================================================"
- echo -e "#!/bin/bash\n[ -x /etc/icpc/setup.sh ] && /etc/icpc/setup.sh\n\n" > /tmp/.boca.tmp
- cat /etc/gdm/Init/Default >> /tmp/.boca.tmp
- mv /tmp/.boca.tmp /etc/gdm/Init/Default
- chmod 755 /etc/gdm/Init/Default
-fi
-if [ "$startscript" != "OK" ]; then
- echo "************ STARTUP CALL OF SCRIPTS NOT CONFIGURED **************"
- echo "****** neither /etc/gdm/Init nor /etc/lightdm/lightdm.conf were found ************"
-fi
-
-if [ -f /etc/icpc/createbocajail.sh ]; then
- chmod 750 /etc/icpc/createbocajail.sh
- if [ "$2" != "notbuildjail" ]; then
- /etc/icpc/createbocajail.sh
- fi
-else
- echo "************** SCRIPT TO CREATE BOCAJAIL NOT FOUND -- SOMETHING LOOKS WRONG ***************"
-fi
-
-# BOCA CONFIG
-if [ -f /etc/icpc/installboca.sh ]; then
- chmod 750 /etc/icpc/installboca.sh
- /sbin/iptables -F
- /etc/icpc/installboca.sh "$3" "$4"
-else
- echo "************* SCRIPT TO INSTALL BOCA NOT FOUND -- SOMETHING IS WRONG -- I CANT INSTALL BOCA **************"
-fi
-
-fi
diff --git a/tools/sendscore.sh b/tools/sendscore.sh
deleted file mode 100755
index 72393c3..0000000
--- a/tools/sendscore.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/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 22/oct/2012 by cassio@ime.usp.br
-
-if [ "$1" == "" -o "$2" == "" -o "$3" == "" -o "$4" == "" ]; then
- echo "Usage $0 <scorefile> <BOCAaddress> <user> <password> [<PC2site>]"
- echo "e.g. $0 score.dat http://bombonera.ime.usp.br/boca site1 hardpass"
- echo " $0 summary.html http://bombonera.ime.usp.br/boca site1 hardpass 1"
- echo "the last number in the previous line indicates the number of the site, which should be unique among sites"
- exit 1
-fi
-BOCASERVER=$2
-user=$3
-pass=$4
-pc2=0
-if [ "$5" != "" ]; then
-pc2=$5
-fi
-
-for i in wget tr perl shasum cut; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-
-if [ -r "$1" ]; then
-md=`wget -S -T3 -t3 $BOCASERVER/index.php -O /dev/null --save-cookies /tmp/.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1 | cut -f2 -d'=' | cut -f1 -d';'`
-res=`echo -n $pass | shasum -a 256 - | cut -f1 -d' '`
-res=`echo -n "${res}${md}" | shasum -a 256 - | cut -f1 -d' '`
-wget -T3 -t3 "$BOCASERVER/index.php?name=${user}&password=${res}&action=scoretransfer" --load-cookies /tmp/.cookie.txt --keep-session-cookies --save-cookies /tmp/.cookie.txt -O /tmp/.temp.txt 2>/dev/null >/dev/null
-grep -qi incorrect /tmp/.temp.txt
-if [ $? == 0 ]; then
- echo User or password incorrect
-else
-nom=`echo -n $1 | perl -MURI::Escape -lne 'print uri_escape($_)'`
-echo -n "PC2=${pc2}&name=${nom}&data=" > /tmp/.temp.txt
-if [ "$pc2" != "0" ]; then
- uuencode -m zzzzzzzzzz < "$1" | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> /tmp/.temp.txt
-else
- cat "$1" | perl -MURI::Escape -lne 'print uri_escape($_)' >> /tmp/.temp.txt
-fi
-wget -t3 -T3 "$BOCASERVER/site/putfile.php" --load-cookies /tmp/.cookie.txt --keep-session-cookies -O /tmp/.temp2.txt --post-file=/tmp/.temp.txt >/dev/null 2>/dev/null
-[ -r /tmp/.temp2.txt ] && cat /tmp/.temp2.txt
-rm -f /tmp/.temp2.txt
-fi
-rm -f /tmp/.temp.txt
-rm -f /tmp/.cookie.txt
-else
- echo file $1 not found
-fi
diff --git a/tools/singlefilebkp.sh b/tools/singlefilebkp.sh
index 8f68c41..da7d91d 100755
--- a/tools/singlefilebkp.sh
+++ b/tools/singlefilebkp.sh
@@ -22,14 +22,14 @@ if [ "$1" == "" ]; then
fi
if [ -r "$1" ]; then
-md=`wget -S http://$BOCASERVER/boca/index.php -O /dev/null --save-cookies /tmp/.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1 | cut -f2 -d'=' | cut -f1 -d';'`
+md=`wget -S https://$BOCASERVER/boca/index.php -O /dev/null --save-cookies /tmp/.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1 | cut -f2 -d'=' | cut -f1 -d';'`
echo -n "User: "
read user
echo -n "Password: "
read pass
res=`echo -n $pass | md5sum - | cut -f1 -d' '`
res=`echo -n "${res}${md}" | md5sum - | cut -f1 -d' '`
-wget "http://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies /tmp/.cookie.txt --keep-session-cookies --save-cookies /tmp/.cookie.txt -O /tmp/.temp.txt 2>/dev/null >/dev/null
+wget "https://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies /tmp/.cookie.txt --keep-session-cookies --save-cookies /tmp/.cookie.txt -O /tmp/.temp.txt 2>/dev/null >/dev/null
grep -qi incorrect /tmp/.temp.txt
if [ $? == 0 ]; then
echo User or password incorrect
@@ -37,7 +37,7 @@ else
nom=`echo -n $1 | perl -MURI::Escape -lne 'print uri_escape($_)'`
echo -n "name=${nom}&data=" > /tmp/.temp.txt
uuencode -m zzzzzzzzzz < $1 | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> /tmp/.temp.txt
-wget "http://$BOCASERVER/boca/team/getfile.php" --load-cookies /tmp/.cookie.txt --keep-session-cookies -O /dev/null --post-file=/tmp/.temp.txt >/dev/null 2>/dev/null
+wget "https://$BOCASERVER/boca/team/getfile.php" --load-cookies /tmp/.cookie.txt --keep-session-cookies -O /dev/null --post-file=/tmp/.temp.txt >/dev/null 2>/dev/null
fi
rm -f /tmp/.temp.txt
rm -f /tmp/.cookie.txt
diff --git a/tools/updatescore.sh b/tools/updatescore.sh
deleted file mode 100755
index 546e17f..0000000
--- a/tools/updatescore.sh
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/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 updated 01/nov/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
-
-privatedir=$bocadir/src/private/remotescores
-others=$privatedir/otherservers
-if [ "$1" == "" -o "$2" == "" ]; then
- echo "Usage $0 <remotescorefolder> <serversfile>"
- echo "e.g. $0 $privatedir $others"
- echo "*** When arguments are not given, default values as of the previous line is used"
-fi
-if [ "$1" != "" ]; then
- privatedir=$1
-fi
-if [ "$2" != "" ]; then
- others=$2
-else
- others=$privatedir/otherservers
-fi
-
-for i in id chown chmod md5sum shasum wget tr cut awk tail head grep cat sed sleep; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo command "$i" not found
- exit 1
- fi
-done
-if [ "`id -u`" != "0" ]; then
- echo "Script must run as root"
-fi
-
-if [ ! -d $privatedir ]; then
- echo "Could not find directory $privatedir"
- exit 1
-fi
-tempdir=$privatedir/tmp
-mkdir -p $tempdir >/dev/null 2>/dev/null
-if [ ! -d $tempdir ]; then
- echo "Could not create directory $tempdir"
- exit 1
-fi
-httpbocadir=boca
-secs=120
-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
-[ $? != 0 ] && echo "User $apacheuser not found -- error to set permissions with chown/chmod"
-
-hash="shasum -a 256 -"
-#hash="md5sum -"
-
-#rm -f $privatedir/score_*.dat
-chown $apacheuser.root $privatedir/score_*.dat
-
-if [ ! -r $others ]; then
- echo "External server list in $others not found"
- exit 1
-fi
-echo "Starting loop to get scores from servers defined in $others"
-while /bin/true; do
- echo "Getting scores..."
- qtd=1
- for BOCASERVER in `grep -v "^[ \t]*\#" $others | awk '{ print $1; }'`; do
- if [ "$BOCASERVER" == "" ]; then
- continue
- fi
- echo $BOCASERVER | grep -q "http"
- [ $? == 0 ] || BOCASERVER=http://$BOCASERVER/boca
-
- user=`grep -v "^[ \t]*\#" $others | head -n$qtd | tail -n1 | awk '{ print $2; }'`
- [ "$user" == "" ] && user=score
- pass=`grep -v "^[ \t]*\#" $others | head -n$qtd | tail -n1 | awk '{ print $2; }'`
- [ "$pass" == "" ] && pass=score
- let "qtd = $qtd + 1"
-
- echo -n "Asking server $BOCASERVER. Authenticating with user '$user'..."
- md=`wget -t3 -T3 -S $BOCASERVER/index.php -O /dev/null --save-cookies $tempdir/.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1 | cut -f2 -d'=' | cut -f1 -d';'`
- res=`echo -n $pass | $hash | cut -f1 -d' '`
- res=`echo -n "${res}${md}" | $hash | cut -f1 -d' '`
- echo -n "sending password..."
- wget -t3 -T3 "$BOCASERVER/index.php?name=${user}&password=${res}" --load-cookies $tempdir/.cookie.txt --keep-session-cookies --save-cookies $tempdir/.cookie.txt -O $tempdir/.temp.txt 2>/dev/null >/dev/null
- grep -qi incorrect $tempdir/.temp.txt
- if [ "$?" != "0" ]; then
- rm -f $tempdir/*
- echo "downloading scoretable..."
- wget -t3 -T3 "$BOCASERVER/scoretable.php?remote=-42" --load-cookies $tempdir/.cookie.txt --keep-session-cookies --save-cookies $tempdir/.cookie.txt -O $tempdir/score.zip 2>$tempdir/.bocascore.tmp >$tempdir/.bocascore.tmp
- if [ "$?" == "0" ]; then
- unzip -qq $tempdir/score.zip -d $tempdir
- if [ "$?" == "0" ]; then
- for fscore in `ls -d $tempdir/*.dat`; do
- chown $apacheuser.root "$fscore"
- chmod 660 "$fscore"
- bfscore=`basename $fscore`
- hasscore=`echo $bfscore | cut -d'_' -f1`
- if [ "$hasscore" != "score" ]; then
- bfscore=score_$bfscore
- fi
- mv "$fscore" "$privatedir/$bfscore"
- echo "Score downloaded successfully into $privatedir/$bfscore"
- done
- else
- echo "Error: score file from $BOCASERVER is not a valid package"
- fi
- else
- echo "Error getting score file from $BOCASERVER: `cat $tempdir/.bocascore.tmp`"
- fi
- else
- echo "Error authenticating to server $BOCASERVER"
- fi
- rm -f $tempdir/.temp.txt
- rm -f $tempdir/.cookie.txt
- done
-
- echo -n "Waiting $secs secs..."
- sleep $secs
- echo ""
-done