aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2014-10-30 13:06:31 +0000
committercassiopc <cassiopc@gmail.com>2014-10-30 13:06:31 +0000
commit299167dab2835fd91ce67a84deb515fea76246a3 (patch)
treeae698bf68bdffedd735b443ac90fc13d2a6b7a3f
parentc00c84f2b36aabc95370bca8004f170c2d28ce60 (diff)
parent6692c1b3d36449575ae669131c782d4a48aa8c8f (diff)
downloadboca-299167dab2835fd91ce67a84deb515fea76246a3.tar.gz
boca-299167dab2835fd91ce67a84deb515fea76246a3.zip
Merge branch 'master' of https://code.google.com/p/boca
-rw-r--r--doc/changelog.txt4
-rwxr-xr-xdoc/problemexamples/problemtemplate/compare/cc97
-rw-r--r--doc/problemexamples/problemtemplate/compile/cc173
-rw-r--r--doc/problemexamples/problemtemplate/limits/cc15
-rwxr-xr-xdoc/problemexamples/problemtemplate/run/cc128
-rw-r--r--src/admin/user.php7
-rw-r--r--src/fcontest.php11
-rwxr-xr-xtools/etc/icpc/createbocajail.sh20
-rwxr-xr-xtools/installv2.sh40
9 files changed, 480 insertions, 15 deletions
diff --git a/doc/changelog.txt b/doc/changelog.txt
index 1d74489..923f426 100644
--- a/doc/changelog.txt
+++ b/doc/changelog.txt
@@ -1,3 +1,7 @@
+version 1.5.9:
+- allow password change as default (can be blocked by input users via file)
+- inclusion of default language C++11
+
version 1.5.8:
- force empty language/problem as default selection of teams' runs
- accept url+user+password at field main contest url to exchange scoreboards
diff --git a/doc/problemexamples/problemtemplate/compare/cc b/doc/problemexamples/problemtemplate/compare/cc
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/doc/problemexamples/problemtemplate/compare/cc
@@ -0,0 +1,97 @@
+#!/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 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/doc/problemexamples/problemtemplate/compile/cc b/doc/problemexamples/problemtemplate/compile/cc
new file mode 100644
index 0000000..b1f7c8a
--- /dev/null
+++ b/doc/problemexamples/problemtemplate/compile/cc
@@ -0,0 +1,173 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // 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
+# // 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/august/2014 by cassio@ime.usp.br
+# definition of -std=c++11
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ cp "$name" src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" ]; then
+ if [ "$4" -gt "0" ]; then
+ maxm=${4}000
+ fi
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let "ttime = $time + 30"
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f "$exe" compileit.retcode runit.retcode 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which g++\`
+[ -x "\$cc" ] || cc=/usr/bin/g++
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -std=c++11 -static -O2 -o "../$exe" "$name" -lm
+echo \$? > ../compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ echo "Internal directory is $cdir"
+ cat <<EOF > runit.sh
+#!/bin/bash
+cd "$cdir"
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+if [ ! -d /bocajail ]; then
+ /bin/umount /proc 2>/dev/null
+ #/bin/umount /dev
+ /bin/umount /sys 2>/dev/null
+fi
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ if [ -r runit.retcode ]; then
+ ret=`cat runit.retcode`
+ else
+ ret=99
+ fi
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+if [ -f "stdout0" ]; then
+ cat "stdout0"
+fi
+if [ -f "stderr0" ]; then
+ cat "stderr0"
+fi
+rm -rf src/
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/doc/problemexamples/problemtemplate/limits/cc b/doc/problemexamples/problemtemplate/limits/cc
new file mode 100644
index 0000000..b5aec73
--- /dev/null
+++ b/doc/problemexamples/problemtemplate/limits/cc
@@ -0,0 +1,15 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and the maximum file size in the fourth line (in kbytes)
+echo 1024
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/doc/problemexamples/problemtemplate/run/cc b/doc/problemexamples/problemtemplate/run/cc
new file mode 100755
index 0000000..b283366
--- /dev/null
+++ b/doc/problemexamples/problemtemplate/run/cc
@@ -0,0 +1,128 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // 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
+# // 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: 21/aug/2014 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in MBytes)
+# $6 maximum allowed output size (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -x "$1" ]; then
+ echo "$1 not found (or is not in the current dir) or it's not executable"
+ exit 44
+fi
+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
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" ]; then
+ if [ "$4" -gt "0" ]; then
+ nruns=$4
+ fi
+fi
+maxm=512000
+if [ "$5" != "" ]; then
+ if [ "$5" -gt "0" ]; then
+ maxm=${5}000
+ fi
+fi
+maxf=1024
+if [ "$6" != "" ]; then
+ if [ "$6" -gt "0" ]; then
+ maxf=${6}
+ fi
+fi
+
+cp "$2" stdin0 2>/dev/null
+cp "$1" run.exe 2>/dev/null
+
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $1 is not statically linked"
+ exit 47
+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
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/src/admin/user.php b/src/admin/user.php
index 3a1c032..b19c0d0 100644
--- a/src/admin/user.php
+++ b/src/admin/user.php
@@ -1,7 +1,7 @@
<?php
////////////////////////////////////////////////////////////////////////////////
//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,7 +15,9 @@
// 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 20/sep/2013 by cassio@ime.usp.br
+// Last modified 26/oct/2014 by cassio@ime.usp.br
+// allow passwords to be changed by default
+//
require('header.php');
if (isset($_GET["site"]) && isset($_GET["user"]) && is_numeric($_GET["site"]) && is_numeric($_GET["user"]) &&
@@ -49,6 +51,7 @@ if (isset($_POST["username"]) && isset($_POST["userfullname"]) && isset($_POST["
$param['type'] = htmlspecialchars($_POST["usertype"]);
$param['permitip'] = htmlspecialchars($_POST["userip"]);
$param['contest'] = $_SESSION["usertable"]["contestnumber"];
+ $param['changepass']='t';
/*
$param['user'] = myhtmlspecialchars($_POST["usernumber"]);
$param['site'] = myhtmlspecialchars($_POST["usersitenumber"]);
diff --git a/src/fcontest.php b/src/fcontest.php
index a36141e..7adbaab 100644
--- a/src/fcontest.php
+++ b/src/fcontest.php
@@ -1,7 +1,7 @@
<?php
////////////////////////////////////////////////////////////////////////////////
//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,8 +15,9 @@
// 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 12/sep/2013 by cassio@ime.usp.br
-
+//Last updated 26/oct/2014 by cassio@ime.usp.br
+// inclusion of default extra language C++11
+//
function DBDropContestTable() {
$c = DBConnect();
$r = DBExec($c, "drop table \"contesttable\"", "DBDropContestTable(drop table)");
@@ -990,6 +991,10 @@ function insertlanguages($n,$c=null) {
$param['name']='Java';
$param['extension']='java';
DBNewLanguage($n, $param, $c);
+ $param['number']=4;
+ $param['name']='C++11';
+ $param['extension']='cc';
+ DBNewLanguage($n, $param, $c);
}
function insertanswers($n,$c) {
DBExec($c, "insert into answertable (contestnumber, answernumber, runanswer, yes, fake) values ".
diff --git a/tools/etc/icpc/createbocajail.sh b/tools/etc/icpc/createbocajail.sh
index bd8bd5d..75d39ec 100755
--- a/tools/etc/icpc/createbocajail.sh
+++ b/tools/etc/icpc/createbocajail.sh
@@ -59,7 +59,6 @@ rm -rf /bocajail
mkdir -p $homejail/tmp
chmod 1777 $homejail/tmp
ln -s $homejail /bocajail
-[ -x /usr/bin/safeexec ] && cp -a /usr/bin/safeexec /bocajail/usr/bin/
#for i in usr lib var bin sbin etc dev; do
# [ -d $homejail/$i ] && rm -rf $homejail/$i
# cp -ar /$i $homejail
@@ -114,9 +113,28 @@ cat <<EOF > /home/bocajail/tmp/populate.sh
#!/bin/bash
mount -t proc proc /proc
apt-get -y update
+apt-get -y install python-software-properties
+add-apt-repository -y ppa:ubuntu-toolchain-r/test
+apt-get -y update
+apt-get -y upgrade
apt-get -y install g++ gcc libstdc++6 sharutils default-jdk default-jre
+apt-get -y install gcc-4.8 g++-4.8
+apt-get -y install openjdk-7-jdk openjdk-7-jre
+apt-get -y clean
+
+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
+
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
cd / ; chroot $homejail /tmp/populate.sh
diff --git a/tools/installv2.sh b/tools/installv2.sh
index 0223636..69131bf 100755
--- a/tools/installv2.sh
+++ b/tools/installv2.sh
@@ -15,10 +15,11 @@
# // 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/Aug/2014 by cassio@ime.usp.br
+# // Last modified 27/Oct/2014 by cassio@ime.usp.br
+# // inclusion of gcc-4.8 and update to Java 7
#///////////////////////////////////////////////////////////////////////////////////////////
echo "#############################################################"
-echo "### installv2.sh of 21/Aug/2014 (A) by cassio@ime.usp.br ###"
+echo "### installv2.sh of 27/Oct/2014 (A) by cassio@ime.usp.br ###"
echo "#############################################################"
if [ "`id -u`" != "0" ]; then
@@ -89,15 +90,19 @@ if [ $? != 0 ]; then
fi
fi
-echo "====================================================================="
-echo "============== CHECKING FOR canonical.com APT SERVER ==============="
-echo "====================================================================="
-
+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
@@ -128,8 +133,8 @@ 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-6-dbg \
- php5 php5-pgsql postgresql postgresql-client postgresql-contrib quota sharutils default-jdk openjdk-6-doc \
+ 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
@@ -137,6 +142,23 @@ if [ $? != 0 ]; then
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`
@@ -159,7 +181,7 @@ cat <<EOF > /etc/skel/Desktop/javadoc.desktop
Version=1.5.1
Name=Java API
Comment=Java API
-Exec=firefox /usr/share/doc/openjdk-6-jre-headless/api/index.html
+Exec=firefox /usr/share/doc/openjdk-7-jre-headless/api/index.html
Terminal=false
Type=Application
EOF