diff options
Diffstat (limited to 'tools/etc')
| -rwxr-xr-x | tools/etc/icpc/installboca.sh | 4 | ||||
| -rwxr-xr-x | tools/etc/icpc/setup.sh | 10 | ||||
| -rwxr-xr-x | tools/etc/icpc/update.sh | 8 | ||||
| -rw-r--r-- | tools/etc/network/if-pre-up.d/boca | 7 | ||||
| -rwxr-xr-x | tools/etc/rc.local | 9 |
5 files changed, 32 insertions, 6 deletions
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 |