aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorcassio <cassiopc@gmail.com>2015-08-28 09:31:34 +0000
committercassio <cassiopc@gmail.com>2015-08-28 09:31:34 +0000
commit56b10a617339563cda2c761e77b3acb96a1b084c (patch)
treeb0856564f7652ec2940aa6f0595cef1c7b73b52a /tools
parent2a185532e3a0acf9e37e601fc71c148510dd36a7 (diff)
downloadboca-56b10a617339563cda2c761e77b3acb96a1b084c.tar.gz
boca-56b10a617339563cda2c761e77b3acb96a1b084c.zip
small bug fixes
Diffstat (limited to 'tools')
-rwxr-xr-x[-rw-r--r--]tools/boca-submit-run1
-rwxr-xr-x[-rw-r--r--]tools/boca-submit-run-cron0
-rwxr-xr-x[-rw-r--r--]tools/boca-submit-run-root0
-rwxr-xr-xtools/etc/icpc/installboca.sh4
-rwxr-xr-xtools/etc/icpc/setup.sh10
-rwxr-xr-xtools/etc/icpc/update.sh8
-rw-r--r--tools/etc/network/if-pre-up.d/boca7
-rwxr-xr-xtools/etc/rc.local9
-rwxr-xr-xtools/genpackage.sh2
-rwxr-xr-xtools/install_12_04.sh405
-rwxr-xr-xtools/install_14_04_3.sh31
-rwxr-xr-xtools/installv2.sh137
12 files changed, 495 insertions, 119 deletions
diff --git a/tools/boca-submit-run b/tools/boca-submit-run
index 4158a4c..87daeb8 100644..100755
--- a/tools/boca-submit-run
+++ b/tools/boca-submit-run
@@ -1,6 +1,5 @@
#!/bin/bash
-[ -x /etc/icpc/bocaservers.sh ] && . /etc/icpc/bocaservers.sh
[ -x /etc/icpc/bocaserver.sh ] && . /etc/icpc/bocaserver.sh
if [ "$BOCASERVER" != "" ]; then
if [ "$BOCASERVERS" == "" ]; then
diff --git a/tools/boca-submit-run-cron b/tools/boca-submit-run-cron
index c77b4d5..c77b4d5 100644..100755
--- a/tools/boca-submit-run-cron
+++ b/tools/boca-submit-run-cron
diff --git a/tools/boca-submit-run-root b/tools/boca-submit-run-root
index 21ecbc6..21ecbc6 100644..100755
--- a/tools/boca-submit-run-root
+++ b/tools/boca-submit-run-root
diff --git a/tools/etc/icpc/installboca.sh b/tools/etc/icpc/installboca.sh
index 427f73c..bea085c 100755
--- a/tools/etc/icpc/installboca.sh
+++ b/tools/etc/icpc/installboca.sh
@@ -147,7 +147,6 @@ chmod 755 boca-$bocaver/tools/.htaccess
cp boca-$bocaver/tools/.htaccess boca-$bocaver/doc/.htaccess
cp boca-$bocaver/tools/.htaccess boca-$bocaver/old/.htaccess
cp boca-$bocaver/tools/.htaccess boca-$bocaver/src/private/.htaccess
-cp boca-$bocaver/tools/.htaccess boca-$bocaver/src/webcast/.htaccess
chmod -R 770 boca-$bocaver/src/private
chmod -R 775 boca-$bocaver/src/balloons
@@ -184,6 +183,7 @@ 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
OK=n
echo "You can run at anytime later the script /etc/icpc/becomeserver.sh to prepare the computer to be the BOCA server"
@@ -213,3 +213,5 @@ cat > /etc/apache2/conf.d/boca <<EOF
</Directory>
Alias /boca $basedir/boca/src
EOF
+
+ln -s /etc/apache2/conf.d/boca /etc/apache2/conf-enabled/boca.conf
diff --git a/tools/etc/icpc/setup.sh b/tools/etc/icpc/setup.sh
index a854581..da5a334 100755
--- a/tools/etc/icpc/setup.sh
+++ b/tools/etc/icpc/setup.sh
@@ -4,7 +4,7 @@ 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" --width=500 --height=100 --entry`
+If this is supposed to be the server, then leave it empty\nIf there are multiple servers, separate IPs by a semi-colon ;" --width=500 --height=100 --entry`
[ "$IP" == "" ] && IP=LOCAL
zenity --title="IP confirmation" --text="The chosen IP is $IP\nDo you confirm?" --question
OK=$?
@@ -13,8 +13,12 @@ If this is supposed to be the server, then leave it empty" --width=500 --height=
IP=127.0.0.1
BOCASERVER=0/0
fi
- echo "BOCASERVER=$IP" > /etc/icpc/bocaserver.sh
- echo "$IP boca boca" >> /etc/hosts
+ FIRSTBOCA=`echo $IP | cut -d';' -f1`
+ echo "BOCASERVER=$FIRSTBOCA" > /etc/icpc/bocaserver.sh
+ if [ "`echo $IP | cut -d';' -f2-`" != "" ]; 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
diff --git a/tools/etc/icpc/update.sh b/tools/etc/icpc/update.sh
index f6b4bb6..78a87bb 100755
--- a/tools/etc/icpc/update.sh
+++ b/tools/etc/icpc/update.sh
@@ -2,7 +2,12 @@
if [ "`id -u`" != "0" ]; then
echo "Script must run as root"
fi
-wget -O /tmp/update.sh "http://www.ime.usp.br/~cassio/boca/update.sh"
+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
@@ -11,4 +16,5 @@ echo ">>>>>>>>>>"
echo ">>>>>>>>>> Running update script"
echo ">>>>>>>>>>"
/tmp/update.sh
+rm -f /tmp/update.sh
exit $?
diff --git a/tools/etc/network/if-pre-up.d/boca b/tools/etc/network/if-pre-up.d/boca
index f65a27f..3e5eb5b 100644
--- a/tools/etc/network/if-pre-up.d/boca
+++ b/tools/etc/network/if-pre-up.d/boca
@@ -8,12 +8,17 @@ fi
/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 143.107.45.122 -j ACCEPT
+/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 | cut -d';'`; 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
diff --git a/tools/etc/rc.local b/tools/etc/rc.local
index 2b0fff8..5bff287 100755
--- a/tools/etc/rc.local
+++ b/tools/etc/rc.local
@@ -25,10 +25,19 @@ grep -q "143.107.255.15.*ntp.usp.br.*ntp.usp.br" /etc/hosts
if [ $? != 0 ]; then
echo "143.107.255.15 ntp.usp.br ntp.usp.br" >> /etc/hosts
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 "45.33.30.235.*boca.bombonera.org.*boca.bombonera.org" /etc/hosts
+if [ $? != 0 ]; then
+ echo "45.33.30.235 boca.bombonera.org boca.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 ntp.usp.br
ntpdate -u ntp.usp.br
exit 0
diff --git a/tools/genpackage.sh b/tools/genpackage.sh
index 82448b9..4830675 100755
--- a/tools/genpackage.sh
+++ b/tools/genpackage.sh
@@ -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='2014';\n?>\n" > boca-$ver/src/versionnum.php
+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
diff --git a/tools/install_12_04.sh b/tools/install_12_04.sh
new file mode 100755
index 0000000..e7a7474
--- /dev/null
+++ b/tools/install_12_04.sh
@@ -0,0 +1,405 @@
+#!/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/install_14_04_3.sh b/tools/install_14_04_3.sh
index 084248a..bf5ed20 100755
--- a/tools/install_14_04_3.sh
+++ b/tools/install_14_04_3.sh
@@ -34,12 +34,8 @@ fi
# echo "#!/bin/bash" >/usr/bin/update-notifier
# find /usr/lib -name notify-osd | xargs chmod -x
# killall notify-osd 2>/dev/null
-gconftool -s -t bool /apps/update-notifier/auto_launch false
-if [ -f /usr/share/dbus-1/services/org.freedesktop.Notifications.service ]; then
- mv /usr/share/dbus-1/services/org.freedesktop.Notifications.service /usr/share/dbus-1/services/org.freedesktop.Notifications.service.disabled
-fi
-
apt-get -y install python-software-properties 2>/dev/null
+gconftool -s -t bool /apps/update-notifier/auto_launch false
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`
@@ -122,7 +118,7 @@ apt-get -y install zenity apache2 eclipse-pde eclipse-rcp eclipse-platform eclip
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
+ sublime-text-installer libgnomekbd-common
if [ $? != 0 ]; then
echo ""
echo "ERROR running the apt-get -- must check if all needed packages are available"
@@ -191,18 +187,13 @@ else
echo "user icpc already exists"
fi
-if [ -d /etc/lightdm ]; then
+lightdmfile=/etc/lightdm/lightdm.conf
+if [ -d "`dirname $lightdmfile`" ]; then
echo "=============================================================="
- echo "====== disabling guest account on lightdm.conf ========"
+ echo "====== disabling guest account on lightdm ========"
echo "=============================================================="
- [ -f /etc/lightdm/lightdm.conf ] && grep -q "^[^\#]*allow-guest" /etc/lightdm/lightdm.conf
- if [ $? != 0 ]; then
- echo "allow-guest=false" >> /etc/lightdm/lightdm.conf
- fi
- [ -f /etc/lightdm/lightdm.conf ] && grep -q "^[^\#]*greeter-hide-users" /etc/lightdm/lightdm.conf
- if [ $? != 0 ]; then
- echo "greeter-hide-users=true" >> /etc/lightdm/lightdm.conf
- fi
+ 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 "====================================================================================="
@@ -315,7 +306,7 @@ echo "=============================================================="
echo "================= UPDATING rc.local symlinks ==============="
echo "=============================================================="
-update-rc.d rc.local defaults
+#update-rc.d rc.local defaults
update-rc.d -f cups remove
apt-get -y clean
@@ -326,11 +317,11 @@ apt-get -y clean
#/etc/icpc/setup.sh
startscript="NOTOK"
-if [ -d /etc/lightdm ]; then
+if [ -d "`dirname $lightdmfile`" ]; then
startscript="OK"
- [ -f /etc/lightdm/lightdm.conf ] && grep -q "^[^\#]*display-setup-script=/etc/icpc/setup.sh" /etc/lightdm/lightdm.conf
+ [ -f $lightdmfile ] && grep -q "^[^\#]*greeter-setup-script=/etc/icpc/setup.sh" $lightdmfile
if [ $? != 0 ]; then
- echo "display-setup-script=/etc/icpc/setup.sh" >> /etc/lightdm/lightdm.conf
+ echo "greeter-setup-script=/etc/icpc/setup.sh" >> $lightdmfile
fi
fi
if [ -d /etc/gdm/Init ]; then
diff --git a/tools/installv2.sh b/tools/installv2.sh
index e7a7474..bf5ed20 100755
--- a/tools/installv2.sh
+++ b/tools/installv2.sh
@@ -15,31 +15,27 @@
# // 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
+# // Last modified 26/Aug/2015 by cassio@ime.usp.br
#///////////////////////////////////////////////////////////////////////////////////////////
echo "#############################################################"
-echo "### installv2.sh of 30/Oct/2014 (A) by cassio@ime.usp.br ###"
+echo "### $0 by cassio@ime.usp.br for Ubuntu 14.04.3 ###"
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
+## 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
-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
+gconftool -s -t bool /apps/update-notifier/auto_launch false
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`
@@ -54,7 +50,7 @@ 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"
+ echo "Make the install script executable (using chmod) and run it directly, like ./install.sh"
else
if [ "$1" != "alreadydone" ]; then
@@ -73,31 +69,15 @@ 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 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
+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 ==============="
@@ -108,9 +88,7 @@ grep -q "^[^\#]*deb http://archive.canonical.com.* $DISTRIB_CODENAME .*partner"
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-add-repository -y ppa:webupd8team/sublime-text-3
apt-get -y update
apt-get -y upgrade
@@ -130,12 +108,6 @@ 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 ==============="
@@ -144,28 +116,14 @@ 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
+ 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 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
@@ -187,7 +145,7 @@ echo "=================================================================="
mkdir -p /etc/skel/Desktop/
cat <<EOF > /etc/skel/Desktop/javadoc.desktop
[Desktop Entry]
-Version=1.5.1
+Version=1
Name=Java API
Comment=Java API
Exec=firefox /usr/share/doc/openjdk-7-jre-headless/api/index.html
@@ -196,7 +154,7 @@ Type=Application
EOF
cat <<EOF > /etc/skel/Desktop/stldoc.desktop
[Desktop Entry]
-Version=1.5.1
+Version=1
Name=C++ STL
Comment=C++ STL
Exec=firefox /usr/share/doc/stl-manual/html/index.html
@@ -205,7 +163,7 @@ Type=Application
EOF
cat <<EOF > /etc/skel/Desktop/cppannotations.desktop
[Desktop Entry]
-Version=1.5.1
+Version=1
Name=C++ Annotations
Comment=C++ Annotations
Exec=firefox /usr/share/doc/c++-annotations/html/index.html
@@ -229,34 +187,31 @@ else
echo "user icpc already exists"
fi
-if [ -f /etc/lightdm/lightdm.conf ]; then
+lightdmfile=/etc/lightdm/lightdm.conf
+if [ -d "`dirname $lightdmfile`" ]; then
echo "=============================================================="
- echo "============ disabling guest account on lightdm.conf ========"
+ echo "====== disabling guest account on lightdm ========"
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
+ 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 "====================================================================================="
+# 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)"
+
-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 ==============="
@@ -351,7 +306,7 @@ echo "=============================================================="
echo "================= UPDATING rc.local symlinks ==============="
echo "=============================================================="
-update-rc.d rc.local defaults
+#update-rc.d rc.local defaults
update-rc.d -f cups remove
apt-get -y clean
@@ -362,11 +317,11 @@ apt-get -y clean
#/etc/icpc/setup.sh
startscript="NOTOK"
-if [ -f /etc/lightdm/lightdm.conf ]; then
+if [ -d "`dirname $lightdmfile`" ]; then
startscript="OK"
- grep -q "^[^\#]*display-setup-script=/etc/icpc/setup.sh" /etc/lightdm/lightdm.conf
+ [ -f $lightdmfile ] && grep -q "^[^\#]*greeter-setup-script=/etc/icpc/setup.sh" $lightdmfile
if [ $? != 0 ]; then
- echo "display-setup-script=/etc/icpc/setup.sh" >> /etc/lightdm/lightdm.conf
+ echo "greeter-setup-script=/etc/icpc/setup.sh" >> $lightdmfile
fi
fi
if [ -d /etc/gdm/Init ]; then