diff options
| author | cassio <cassiopc@gmail.com> | 2014-08-26 07:33:49 +0000 |
|---|---|---|
| committer | cassio <cassiopc@gmail.com> | 2014-08-26 07:33:49 +0000 |
| commit | 6a532dd4e6b853ea3c8e5694f57295e8a3b191f7 (patch) | |
| tree | ce63caeeb60be6ac7027665d19a0232bc5a8e31a | |
| parent | a36325e95bfd75af9c37b9e0eac6dcf1028a6f61 (diff) | |
| download | boca-6a532dd4e6b853ea3c8e5694f57295e8a3b191f7.tar.gz boca-6a532dd4e6b853ea3c8e5694f57295e8a3b191f7.zip | |
few minor fixes and possibility of having a hotstandby bkp
| -rw-r--r-- | doc/acknowledgments.txt | 8 | ||||
| -rw-r--r-- | doc/problemexamples/problemtemplate/compile/c | 10 | ||||
| -rw-r--r-- | doc/problemexamples/problemtemplate/compile/cpp | 10 | ||||
| -rw-r--r-- | doc/problemexamples/problemtemplate/compile/java | 2 | ||||
| -rwxr-xr-x | doc/problemexamples/problemtemplate/run/c | 8 | ||||
| -rwxr-xr-x | doc/problemexamples/problemtemplate/run/cpp | 8 | ||||
| -rwxr-xr-x | doc/problemexamples/problemtemplate/run/java | 14 | ||||
| -rwxr-xr-x | src/globals.php | 4 | ||||
| -rw-r--r-- | src/version | 2 | ||||
| -rw-r--r-- | src/versionnum.php | 4 | ||||
| -rw-r--r-- | tools/READMEubuntu.txt | 33 | ||||
| -rw-r--r-- | tools/READMEvm.txt | 163 | ||||
| -rwxr-xr-x | tools/dump.sh (renamed from doc/dump.sh) | 0 | ||||
| -rwxr-xr-x | tools/etc/icpc/becomeserver.sh | 68 | ||||
| -rwxr-xr-x[-rw-r--r--] | tools/etc/icpc/update.sh | 0 | ||||
| -rwxr-xr-x | tools/etc/icpc/updatedbpass.sh | 1 | ||||
| -rwxr-xr-x | tools/genpackage.sh | 10 | ||||
| -rwxr-xr-x | tools/installv2.sh | 46 | ||||
| -rw-r--r-- | tools/postgresql.conf.diffs | 5 |
19 files changed, 136 insertions, 260 deletions
diff --git a/doc/acknowledgments.txt b/doc/acknowledgments.txt index c939d15..8ce2782 100644 --- a/doc/acknowledgments.txt +++ b/doc/acknowledgments.txt @@ -1,6 +1,6 @@ BOCA Acknowledgments ------------------- -(last updated 25/October/2012) +(last updated 21/August/2014) This is a very important file of BOCA. It gives a list of people we must acknowledge for having in a way or another helping BOCA reach its current development situation. @@ -11,7 +11,7 @@ created much after the begining of BOCA, so there will be many many missing name do not be shine and do help us to fill this list! Also if you see some incoherency on the lists, let us know! Thanks! -I will divide the list into two section: those who effectively contributed in ideas for the +The list is divided into two section: those who effectively contributed in ideas for the code, and those who found bugs and/or suggested modifications. Names are given in no particular order. @@ -25,7 +25,7 @@ CODE - Alejandro Sazo - Jorge Luis R. Alvarez - Vinicius K. Ruoso - +- Mario Sanchez REPORTERS/COMMENTATORS - Guillermo Solis @@ -37,4 +37,4 @@ REPORTERS/COMMENTATORS - Juan Pablo G. Ibarra - Ricardo Dahab - Liliane Salgado - +- Diego Rubert diff --git a/doc/problemexamples/problemtemplate/compile/c b/doc/problemexamples/problemtemplate/compile/c index 5376708..77631ec 100644 --- a/doc/problemexamples/problemtemplate/compile/c +++ b/doc/problemexamples/problemtemplate/compile/c @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) +# // Copyright (C) 2003-2014 by BOCA System (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 @@ -15,12 +15,12 @@ # // 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: 21/july/2012 by cassio@ime.usp.br +#Last modified: 21/august/2014 by cassio@ime.usp.br # # parameters are: # $1 source_file # $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) +# $3 timelimit # $4 maximum allowed memory (in MBytes, default 512M) # # the output of the submission should be directed to the standard output @@ -105,7 +105,7 @@ else exe=$2 fi -rm -f $exe compileit.retcode runit.retcode 2>/dev/null +rm -f "$exe" compileit.retcode runit.retcode 2>/dev/null cat <<EOF > compileit.sh #!/bin/bash cc=\`which gcc\` @@ -115,7 +115,7 @@ if [ ! -x "\$cc" ]; then exit 47 fi cd src -"\$cc" -static -O2 -o ../$exe $name -lm +"\$cc" -static -O2 -o "../$exe" "$name" -lm echo \$? > ../compileit.retcode exit 0 EOF diff --git a/doc/problemexamples/problemtemplate/compile/cpp b/doc/problemexamples/problemtemplate/compile/cpp index 6a61bc1..2da3e4a 100644 --- a/doc/problemexamples/problemtemplate/compile/cpp +++ b/doc/problemexamples/problemtemplate/compile/cpp @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) +# // Copyright (C) 2003-2014 by BOCA System (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 @@ -15,12 +15,12 @@ # // 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: 21/july/2012 by cassio@ime.usp.br +#Last modified: 21/august/2014 by cassio@ime.usp.br # # parameters are: # $1 source_file # $2 exe_file (default run.exe) -# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition) +# $3 timelimit # $4 maximum allowed memory (in MBytes) # # the output of the submission should be directed to the standard output @@ -105,7 +105,7 @@ else exe=$2 fi -rm -f $exe compileit.retcode runit.retcode 2>/dev/null +rm -f "$exe" compileit.retcode runit.retcode 2>/dev/null cat <<EOF > compileit.sh #!/bin/bash cc=\`which g++\` @@ -115,7 +115,7 @@ if [ ! -x "\$cc" ]; then exit 47 fi cd src -"\$cc" -static -O2 -o ../$exe $name -lm +"\$cc" -static -O2 -o "../$exe" "$name" -lm echo \$? > ../compileit.retcode exit 0 EOF diff --git a/doc/problemexamples/problemtemplate/compile/java b/doc/problemexamples/problemtemplate/compile/java index bab8a88..3d3f88e 100644 --- a/doc/problemexamples/problemtemplate/compile/java +++ b/doc/problemexamples/problemtemplate/compile/java @@ -73,7 +73,7 @@ if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then name=`basename $name .ZIP` fi else - cp $name src + cp "$name" src fi chown -R $bocau src chmod -R 700 src diff --git a/doc/problemexamples/problemtemplate/run/c b/doc/problemexamples/problemtemplate/run/c index b46e5f9..b283366 100755 --- a/doc/problemexamples/problemtemplate/run/c +++ b/doc/problemexamples/problemtemplate/run/c @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) +# // Copyright (C) 2003-2014 by BOCA System (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 @@ -15,7 +15,7 @@ # // 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/aug/2012 by cassio@ime.usp.br +#Last modified: 21/aug/2014 by cassio@ime.usp.br # # parameters are: # $1 exe_file @@ -74,7 +74,7 @@ if [ ! -r "$2" ]; then echo "$2 not found (or is not in the current dir) or it's not readable" exit 45 fi -if [ ! -x $sf ]; then +if [ ! -x "$sf" ]; then echo "$sf not found or it's not executable" exit 46 fi @@ -117,7 +117,7 @@ fi cdir=`pwd` echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe +"$sf" -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe ret=$? if [ $ret -gt 10 ]; then ret=0 diff --git a/doc/problemexamples/problemtemplate/run/cpp b/doc/problemexamples/problemtemplate/run/cpp index b46e5f9..b283366 100755 --- a/doc/problemexamples/problemtemplate/run/cpp +++ b/doc/problemexamples/problemtemplate/run/cpp @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com) +# // Copyright (C) 2003-2014 by BOCA System (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 @@ -15,7 +15,7 @@ # // 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/aug/2012 by cassio@ime.usp.br +#Last modified: 21/aug/2014 by cassio@ime.usp.br # # parameters are: # $1 exe_file @@ -74,7 +74,7 @@ if [ ! -r "$2" ]; then echo "$2 not found (or is not in the current dir) or it's not readable" exit 45 fi -if [ ! -x $sf ]; then +if [ ! -x "$sf" ]; then echo "$sf not found or it's not executable" exit 46 fi @@ -117,7 +117,7 @@ fi cdir=`pwd` echo "Current directory is $cdir -- chrooting on it" >&2 -$sf -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe +"$sf" -F10 -f$maxf -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe ret=$? if [ $ret -gt 10 ]; then ret=0 diff --git a/doc/problemexamples/problemtemplate/run/java b/doc/problemexamples/problemtemplate/run/java index cdaef98..e8e8c7a 100755 --- a/doc/problemexamples/problemtemplate/run/java +++ b/doc/problemexamples/problemtemplate/run/java @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2013 by BOCA System (bocasystem@gmail.com) +# // Copyright (C) 2003-2014 by BOCA System (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 @@ -15,7 +15,7 @@ # // 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: 14/sept/2013 by cassio@ime.usp.br +#Last modified: 21/aug/2014 by cassio@ime.usp.br # # parameters are: # $1 main_class @@ -92,7 +92,7 @@ if [ ! -r "$2" ]; then echo "$2 not found (or is not in the current dir) or it's not readable" exit 45 fi -if [ ! -x $sf ]; then +if [ ! -x "$sf" ]; then echo "$sf not found or it's not executable" exit 46 fi @@ -140,12 +140,12 @@ cd "$cdir" [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys java=`which java` [ -x "\$java" ] || java=/usr/bin/java -if [ ! -x \$java ]; then +if [ ! -x "\$java" ]; then echo "\$java not found or it's not executable" exit 47 fi export CLASSPATH=.:./run.jar:$CLASSPATH -$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- \$java -Xmx${maxm}K -Xms${maxm}K "$name" +"$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- "\$java" -Xmx${maxm}K -Xms${maxm}K "$name" retval=\$? echo \$retval > runit.retcode if [ ! -d /bocajail ]; then @@ -169,11 +169,11 @@ else echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2 java=`which java` [ -x "$java" ] || java=/usr/bin/java - if [ ! -x $java ]; then + if [ ! -x "$java" ]; then echo "$java not found or it's not executable" exit 47 fi - $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}K -Xms${maxm}K "$name" + "$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- "$java" -cp run.jar -Xmx${maxm}K -Xms${maxm}K "$name" ret=$? fi if [ $ret -gt 10 ]; then diff --git a/src/globals.php b/src/globals.php index e65faa6..0f034ce 100755 --- a/src/globals.php +++ b/src/globals.php @@ -1,7 +1,7 @@ <?php //////////////////////////////////////////////////////////////////////////////// //BOCA Online Contest Administrator -// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) +// Copyright (C) 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 @@ -15,7 +15,7 @@ // 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 09/nov/2012 by cassio@ime.usp.br +// Last modified 15/aug/2014 by cassio@ime.usp.br require_once('db.php'); define("dbcompat_1_4_1",true); diff --git a/src/version b/src/version index 9c0d20b..70d6362 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -boca-1.5.8 +boca-1.5.9 diff --git a/src/versionnum.php b/src/versionnum.php index 99a0327..2fa3be1 100644 --- a/src/versionnum.php +++ b/src/versionnum.php @@ -1,5 +1,5 @@ <?php -$BOCAVERSION='boca-1.5.8'; -$YEAR='2013'; +$BOCAVERSION='boca-1.5.9'; +$YEAR='2014'; ?> diff --git a/tools/READMEubuntu.txt b/tools/READMEubuntu.txt deleted file mode 100644 index 09994a8..0000000 --- a/tools/READMEubuntu.txt +++ /dev/null @@ -1,33 +0,0 @@ -ICPC Linux installation script ----------------------------------- -Copyright (c) 2009 C. P. de Campos. -Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. - A copy of the license is included in the section entitled "GNU - Free Documentation License". ---------------------------------- -File last modified: 11/oct/2011 - -==> The installv2.sh script is not necessary if you are using the virtual machine version. This is intended to those that -want to install the system as the host of a computer, or desire to create again the virtual machine version from the beginning. - -The script installv2.sh available here was used to create the "ICPC Linux" image after a standard installation -of the ubuntu (or xubuntu) distribution. This is well-suitable in case you do not want to -use the virtualized version, for example, in the server of the contest. After using the installv2.sh script over a fresh -install of the ubuntu, you reach the exactly same content of the virtual machine version that is available. -Take care with the following points during the installation of the ubuntu: -1) Use the name "icpcadmin" and password "icpcadmin" (no quotes obviously) as the standard user during the installation. -2) Call the machine "icpc" (in the same screen where you set up the username above). -3) Use the simplest partitioning option (that is, everything in a single partition) and choose at least 10GB for it. - -After installing ubuntu, the system reboots. Download the script installv2.sh to the home directory of icpcadmin, -make it executable by chmod 755 installv2.sh, and run it as root: sudo ./installv2.sh -and reboot the system to finish the configuration (such as setting passwords, IPs, etc). -Note this is going to give you a system just like you would get from the box (the virtual machine version). If you -want it to become a server, you must follow the same procedure that is indicated in the READMEvm.txt. This -mainly means that you need to run the script /etc/icpc/becomeserver.sh - -The most recent installv2.sh script is available at http://www.ime.usp.br/~cassio/boca/ link named installv2.sh -In case of any questions, do not hesitate to contact me: bocasystem@gmail.com. Have fun! diff --git a/tools/READMEvm.txt b/tools/READMEvm.txt deleted file mode 100644 index e78fca8..0000000 --- a/tools/READMEvm.txt +++ /dev/null @@ -1,163 +0,0 @@ -READMEvm.txt file of the ICPC Linux VM (release 2011) -================================= -Copyright (c) 2009-2011 C. P. de Campos. -Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. - A copy of the license is included in the section entitled "GNU - Free Documentation License". -================================= -Last modified: 10/Oct/2011 - -This file concerns the ICPC Linux image available in this directory. It is a vmware-type -hard-disk image with a system built up over a ubuntu (or xubuntu) distribution. This is -also relevant if you have used the installv2.sh script to build the server natively, as the -system will have the exactly same characteristics of the VM version mentioned here. - -- You need the vmplayer from www.vmware.com to use this image. As far as I know, vmplayer is -free-of-charge for linux and windows hosts. Check it. There is another version based on virtualbox, -which is just a translation from the image here. virtualbox is free and works pretty well too. - -- Internet access is restricted inside the box. By default, users can only access -bombonera.ime.usp.br, the home of BOCA. During the first boot time, you are able to choose a -different IP address of your server instead of bombonera. If you are going to run a contest, -you must do that! The system inside the virtual machine (or just VM) will -only be able to access such server and nothing else. An alias with the name boca is created -for such IP, so it is possible to connect to it using the name boca instead of typing the -IP address. So, during the first initialization of each VM you should configure the IP address -of your BOCA server. The image provided here can be used as a BOCA server too. See next bullets -on how to do that. In the team machines, check if the internet is really blocked. If not, the -initialization scripts might be malfunctioning, or the computer might be mistakenly set to be -a server (this can be easily checked by verifying whether the file /etc/icpc/.isserver exists or not). - -- There are two linux users in the box: icpcadmin, which has right to become root using -sudo, and the user icpc. The latter has password icpc, and more restricted access. The user -icpc is intended to be used by the teams, judges, staff, or anyone else. The icpcadmin is -an administrative account and the password must be known only by the sysadmin, director of the -contest, and so on. During the first boot time, you are able to change the password of the icpcadmin -account. DO IT and keep it safe! The default password is icpcadmin. Note that such -users (icpcadmin and icpc) have nothing to do with users of the BOCA web system. Each -team must have a distinct user to login on BOCA, which are configured through the BOCA web interface. -Still, each team will logon into the linux box using the same user: icpc. As mentioned, this is -not a security problem because the user icpc is just a local account in the linux system without -any privileges. - -- To run a contest using a virtual machine, you probably need at least 384MB of RAM inside a -"good" computer (then you can configure the VM to run with 256MB). I have tested the vm image -configured to use 512MB. If your host has for example 1GB, you may change the vmplayer -to use 768MB, although 512 should be fine too. Just keep some room for the underlying operating -system. Using more memory inside the vm is better for the teams, so they can run heavier tools. - -- Unzipped, the image takes around 12 GB of your hard disk. You need this space in the hard -disk of each computer. If this is a problem for you, it is possible to rebuild the vm system -with less space (8GB for clients is enough, the server has to have more). - -- It is possible to maximize the VM window so as it uses the whole screen area. The current -image is set to 800x600 or 1024x768 pixels, but that can probably be increased depending on your -video card and monitor settings. The keyboard config can also be changed -inside the x-window system configurations. - -- During the first startup, an script will ask you for the BOCA database password (after -asking the BOCA server IP address and password of the icpcadmin). YOU MUST ONLY FILL -SUCH PASSWORD IN THERE IF the machine being configured is NOT going to be used by a team. With -this password, it will be possible to access the database directly (instead of by web). Teams -shall access the system only by using the web interface. This password is intended to be used -in the machine that will have the autojudging system, as the autojudging script needs to -connect to the database directly (see next item about the autojudge). In fact only the -autojudging machine (or machines, if you have more than one) need this password to be set. - -- An autojugding machine is used to automatically compile and execute the codes submitted -by the teams. DO NOT run it on the same computer as the BOCA server (the web server and the database -server). Because teams may submit malicious code, it is safe to run it on a separate computer. -The worst scenario (in case a team's code hangs the computer) will require to reboot such -computer. About the configuration, the only difference between the autojudge computer and -team's computers is the setup of the database password, as mentioned before. You must set up -the database password during the initialization of the autojudging computer. Then, to run the -autojudging system, you need to login as icpcadmin (privileged user), open a command-line -terminal (it is inside accessories), and run "sudo /var/www/boca/tools/autojudge.sh" (without quotes). -If everything is fine, some dots will appear on the screen while the script runs an infinite -loop waiting for submissions. Ctrl-C stops the autojudge. The autojudging shall be started -after configuring the server to run the contest, otherwise it will eventually output an error or -freeze. If you see the dots happening every few seconds, you are in the correct track. - -- With old versions of ICPC Linux, all the team files were kept in the server. Now this is -NOT true anymore. Everything is stored locally. So, after a warmup and before the real -contest, it is necessary to go to each team computer, open a command-line shell (you do not -need to change to the privileged user, the unprivilegied icpc user is enough) and run -the command -/etc/icpc/cleandisk.sh -After that, reboot the system inside the virtual machine (not the host computer itself!) and you -are done. All files belonging to the icpc user have been erased. - -- Because the files are stored in the local team computers, now BOCA (by web) has an option -to make file backups, where teams can save their files on the server. Currently this must be done -manually by the teams (using the web interface of BOCA). There is a script available inside the -ICPC linux (and inside the BOCA package) that teams may use to backup their files. To -do that, they can just run "makebkp.sh". If they want to save other files, it is possible to use -the web interface of the teams. Note that teams should submit backup files with small size only, but -that is not a problem because source codes are really small. The script makebkp.sh is available -(but not very tested) which sends files .c, .cpp, .java and .in (it looks for these files in the -current directory) to the server. IT IS IMPORTANT TO LET THE TEAMS KNOW ABOUT THIS SITUATION AND -THE POSSIBILITY OF SAVING FILES TO THE SERVER, EITHER BY USING THE makebkp.sh IN THE COMMAND-LINE, -OR BY DIRECTLY UPLOADING THE FILES IN THE WEB INTERFACE. - -- The most complicated thing to run the contest using a VM is that you need to restrict the -use of the host operating system. For example, it would be possible for a team to switch -the window (from the VM to another program), and then use the internet (in case you have -internet available in the host, which is usually true). I believe that the simplest approach -to restrict the system is to impose a set of packet filtering rules in the host system, using -a firewall solution. That would make the host system useless for the team. The only permission -that the host must have is to allow connections to the BOCA server and (possibly) to the -authentication server of your network (in case it is needed to keep the host running. Better -if that can be avoided too). If your host is linux, then it is easy: you just need to include some -rules in the iptables (certainly a sysadmin knows how to do it). -For windows (which is probably more usual and easy to deal with), there are many free-of-charge -solutions. I do not know them well, but let me cite some: www.r-firewall.com, -www.personalfirewall.comodo.com, tiny personal firewall (it is possible to find it online), -perhaps the windows firewall can be enough (in some windows versions). NOW THE MOST COMMON / -PRACTICAL WAY TO SOLVE THE PROBLEM: keep an eye on the teams all the time. Have some volunteers -looking the teams work on the computers during the whole contest. No one is allowed to leave the -VM and use the underlying system. If they do that, then simply expel them from the contest! -Give a warn of the possible penalty to everyone before starting and that is it. Quick and clean :D - -- Any vm can become a server for the contest, which in this case will be a BOCA server running -inside a virtual machine system. To do that, you just need to login as user -icpcadmin, become root using the command "sudo /bin/bash" -and execute the script /etc/icpc/becomeserver.sh -READ THE FULL TEXT BEFORE RUNNING THIS SCRIPT. THE VM MUST BE IN BRIDGE MODE (see explanation -below). At this moment, you will be prompted to define the DB password or use a random one. After -that, the IP address of this computer must be used to configure all other VMs (during those -startup questions). -Some considerations about a server: more memory must be used for the server. Have a computer -with enough memory and increase the memory of the VM. Also take care with the -disk space. The current image has only around 1.6GB free (still, that must be more than enough). -Finally, note that to run the VM as the server, it must be configured to run in BRIDGE mode -with respect to the network interface, otherwise it will not be possible for other computers -to reach it. BRIDGE mode means that you must look in your vmplayer (whatever player you are using) -to configure the network as in BRIDGE mode). You may need to reboot the VM. If after rebooting it -and running the command-line program "ifconfig" you can see that the IP address of your computer -is the same inside the VM and outside, you are done. Besides that, the underlying operating -system must have NO apache or postgresql running, nor -any other TCP server in the ports 80 (http), 443 (https) and 5432 (postgres). -Yet I point out that running the BOCA system in a server computer (without the VM) -is the mostly tested solution, but the VM version was used in many sites already. If you want to -run it natively, stop here and go to the xubuntu directory of bombonera.ime.usp.br to see the -instructions. You will need a computer that you can format and reinstall. -That is the simplest way of having a full ICPC linux server -running apart from using the VM version itself, as explained here. - -- After having the server and clients running up, it is necessary to configure the BOCA -web system. For that purpose, please follow the steps of the ADMIN.txt file in the doc/ -folder of the boca system. It is available in the BOCA package or inside the ICPC -linux at /var/www/boca/doc/. There are some examples inside the bits/ subfolder. - -- Try to use the vm without fear. In the worst case, download it again and start again -(or even better, keep a copy of the image without changes). Any questions, please -do not hesitate to contact me: bocasystem@gmail.com. - -- If you need to update the BOCA system that is running in your server (with the risk of losing -data in the database of BOCA!), then you may run the script /etc/icpc/installboca.sh -If you need to update general scripts that are used in the system and were installed by the -installv2.sh procedure, you may run the script /etc/icpc/installscripts.sh -These are easy ways to update the system in case bugs are found and fixed. diff --git a/doc/dump.sh b/tools/dump.sh index f3f3282..f3f3282 100755 --- a/doc/dump.sh +++ b/tools/dump.sh diff --git a/tools/etc/icpc/becomeserver.sh b/tools/etc/icpc/becomeserver.sh index 4de2084..7f1cf1b 100755 --- a/tools/etc/icpc/becomeserver.sh +++ b/tools/etc/icpc/becomeserver.sh @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) +# // 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 @@ -15,7 +15,7 @@ # // You should have received a copy of the GNU General Public License # // along with this program. If not, see <http://www.gnu.org/licenses/>. # //////////////////////////////////////////////////////////////////////////////// -# // Last modified 06/aug/2012 by cassio@ime.usp.br +# // 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 @@ -25,6 +25,15 @@ for i in id chown chmod cut awk grep cat sed makepasswd ifconfig iptables php to 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" @@ -90,17 +99,21 @@ for i in `ls /etc/postgresql/*/main/pg_hba.conf`; do 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 0/0 ABOVE (IN THAT FILE) WITH THE IP ADDRESS OF THE AUTOJUDGE MACHINE <==" + 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 <<<" @@ -138,14 +151,49 @@ 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 8` + PASS=`makepasswd --char 10` echo "The DB password is $PASS" fi echo "Keep the DB password safe!" @@ -209,5 +257,17 @@ else 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/update.sh b/tools/etc/icpc/update.sh index f6b4bb6..f6b4bb6 100644..100755 --- a/tools/etc/icpc/update.sh +++ b/tools/etc/icpc/update.sh diff --git a/tools/etc/icpc/updatedbpass.sh b/tools/etc/icpc/updatedbpass.sh index b100af5..a33be16 100755 --- a/tools/etc/icpc/updatedbpass.sh +++ b/tools/etc/icpc/updatedbpass.sh @@ -75,6 +75,7 @@ if [ $? == 0 -a "$BOCASERVER" == "localhost" ]; then 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 diff --git a/tools/genpackage.sh b/tools/genpackage.sh index 749d196..82448b9 100755 --- a/tools/genpackage.sh +++ b/tools/genpackage.sh @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2013 by BOCA Development Team (bocasystem@gmail.com) +# // 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 @@ -15,7 +15,7 @@ # // 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/2013 by cassio@ime.usp.br +# // Last modified 03/sep/2014 by cassio@ime.usp.br cdir=`pwd` bocadir=$(dirname $cdir) basen=`basename $cdir` @@ -34,7 +34,7 @@ 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='2013';\n?>\n" > boca-$ver/src/versionnum.php +echo -e "<?php\n\$BOCAVERSION='boca-$ver';\n\$YEAR='2014';\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 @@ -47,6 +47,10 @@ 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 ../../.. diff --git a/tools/installv2.sh b/tools/installv2.sh index 302c5e4..0223636 100755 --- a/tools/installv2.sh +++ b/tools/installv2.sh @@ -1,7 +1,7 @@ #!/bin/bash # //////////////////////////////////////////////////////////////////////////////// # //BOCA Online Contest Administrator -# // Copyright (C) 2003-2013 by BOCA Development Team (bocasystem@gmail.com) +# // 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 @@ -15,13 +15,21 @@ # // 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 11/sep/2013 by cassio@ime.usp.br +# // Last modified 21/Aug/2014 by cassio@ime.usp.br #/////////////////////////////////////////////////////////////////////////////////////////// echo "#############################################################" -echo "### installv2.sh of 11/Sept/2013 (A) by cassio@ime.usp.br ###" +echo "### installv2.sh of 21/Aug/2014 (A) by cassio@ime.usp.br ###" echo "#############################################################" -apt-get install python-software-properties software-properties-common +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` @@ -39,11 +47,6 @@ if [ $? != 0 ]; then echo "Make the install script executable (using chmod) and run it directly, like ./installv2.sh" else -if [ "`id -u`" != "0" ]; then - echo "Must be run as root" - exit 1 -fi - if [ "$1" != "alreadydone" ]; then echo "It is recommended that you run the commands" echo " apt-get update; apt-get upgrade" @@ -69,9 +72,11 @@ sed -i 's/X-GNOME-Autostart-Delay=60/X-GNOME-Autostart-enabled=false/' /etc/xdg/ echo "=============================================================" echo "========= UNINSTALLING SOME UNNECESSARY PACKAGES ===========" echo "=============================================================" -apt-get -y purge libreoffice-common libreoffice-base-core bluez thunderbird \ - ubuntuone-client python-ubuntuone-client \ - ubuntuone-installer python-ubuntuone-storageprotocol +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 @@ -111,15 +116,21 @@ 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 mii-diag php5-cli php5-mcrypt openjdk-6-dbg \ + evince g++ gcc gedit scite libstdc++6 makepasswd manpages-dev php5-cli php5-mcrypt openjdk-6-dbg \ php5 php5-pgsql postgresql postgresql-client postgresql-contrib quota sharutils default-jdk openjdk-6-doc \ - vim-gnome geany geany-plugin-addons geany-plugin-gdb geany-plugins default-jre sysstat \ + 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 "" @@ -170,9 +181,10 @@ Exec=firefox /usr/share/doc/c++-annotations/html/index.html Terminal=false Type=Application EOF -cp /usr/share/applications/eclipse.desktop /etc/skel/Desktop/ -cp /usr/share/applications/gedit.desktop /etc/skel/Desktop/ -cp /usr/share/applications/emacs23.desktop /etc/skel/Desktop/ +[ -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 diff --git a/tools/postgresql.conf.diffs b/tools/postgresql.conf.diffs deleted file mode 100644 index 1f02936..0000000 --- a/tools/postgresql.conf.diffs +++ /dev/null @@ -1,5 +0,0 @@ -listen_addresses = '*' -max_connections = 300 # (change requires restart) -shared_buffers = 32MB # min 128kB -work_mem = 4MB -maintenance_work_mem = 64MB # min 1MB |