home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ac-grenoble.fr
/
2015.02.ftp.ac-grenoble.fr.tar
/
ftp.ac-grenoble.fr
/
pub
/
slis
/
updates_4.0_rsync
/
slis_update-common-post
< prev
next >
Wrap
Text File
|
2007-06-05
|
7KB
|
187 lines
#!/bin/bash
# This script is part of the SLIS Project initiated by the CARMI-Internet
# (AcadΘmie de Grenoble - France 38).
# Ce script fait partie du projet SLIS dΘmarrΘ par le CARMI-Internet
# (AcadΘmie de Grenoble - France 38).
#
# SLIS : Serveur de communications Linux pour l'Internet Scolaire.
# Copyright (C) 1998-2003 Bruno Bzeznik
#
# 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 2 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 (For example ./COPYING);
# if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.
#
# Please send all comments and bug reports by electronic mail to:
# Bruno Bzeznik <Bruno@ac-grenoble.fr>
# or to <slis@ac-grenoble.fr>
#
# Envoyez vos suggestions et reports de bugs par e-mail α
# Bruno Bzeznik <Bruno@ac-grenoble.fr>
# ou α <slis@ac-grenoble.fr>
#
# Contact: Olivier.LeCam@crdp.ac-versailles.fr
#
# Comments:
# Downloaded via rsync and executed by SLIS during
# the 'slis_update' process
# Started after the version updates
#
# Updates:
# olecam: Jan 9, 2006: script ported to SLIS v4
#
# VARIABLES
#
LOGTAG="slis_update-common-post[$$]"
VERSION=`cat /etc/version_slis_num`
SLIS_LIB="/usr/sbin/slis-sys.inc.bash"
LOCKFILE="/var/lock/slis/slis_update-common-post"
SCRIPT_STATUS_MSG="Script 'common-post'"
. $SLIS_LIB 2>/dev/null
load_config 2>/dev/null
#
# Locking
#
if [ -e $LOCKFILE ]
then
logger -t "$LOGTAG" "Lock found. Update already started."
exit
fi
touch $LOCKFILE
sleep 1
logger -t "$LOGTAG" "$SCRIPT_STATUS_MSG: started."
##############################
############################################################################
### Update BASES SQUIDGUARD - Every day
# ATTENTION: Let this update always at the very end of the update script.
# Please, mirror:
# ftp://ftp.univ-tlse1.fr/pub/reseau/cache/squidguard_contrib
# into your rsync module and maintain academie.tar.gz
############################################################################
if [ -e /usr/local/squid/squidGuard/db ]
then
logger -t "$LOGTAG" "UPDATE URL BLACKLISTS: start"
# olecam, 15/09/2004: Non implΘmentΘ sur les SLIS versaillais
#
# # Test if we have enough memory and cpu to make the .db files
# declare -i MEM=`free -m|grep "Mem:"|awk '{print $2}'`
# declare -i BOGOMIPS=`grep bogomips /proc/cpuinfo |awk '{print $3}'|cut -d. -f1`
# if [ $MEM -lt 127 -o $BOGOMIPS -lt 1500 ]
# then
# LOWRESSOURCES=1
# logger -t "$LOGTAG" "Low ressources detected, will use the precompiled version of the adult blacklist..."
# else
# LOWRESSOURCES=0
# fi
LOWRESSOURCES=0
# Check the version of the files to download
if [ "`cat /etc/version_slis_num`" != "3.1" ]
then
VER=2.x_3.0
else
VER=3.1
fi
# Download the bases
cd /usr/local/squid/squidGuard/db
if [ "$LOWRESSOURCES" = "1" ]
then
rm -f adult.tar.gz
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/adult-precompiled-$VER.tar.bz2 .
else
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/adult.tar.gz .
fi
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/warez.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/forums.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/publicite.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/academie.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/tricheur.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/agressif.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/drogue.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/redirector.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/strict_redirector.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/radio.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/mobile-phone.tar.gz .
rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/webmail.tar.gz .
logger -t "$LOGTAG" "Blacklists installation. PLEASE WAIT..."
# Extract the bases
if [ "$LOWRESSOURCES" = "1" ]
then
rm -f adult/domains
rm -f adult/urls
tar jxf adult-precompiled-$VER.tar.bz2
else
tar zxf adult.tar.gz
fi
tar zxf warez.tar.gz
tar zxf forums.tar.gz
tar zxf publicite.tar.gz
tar zxf academie.tar.gz
tar zxf tricheur.tar.gz
tar zxf agressif.tar.gz
tar zxf drogue.tar.gz
tar zxf redirector.tar.gz
tar zxf strict_redirector.tar.gz
tar zxf radio.tar.gz
tar zxf mobile-phone.tar.gz
tar zxf webmail.tar.gz
/usr/local/sbin/permslis
# Make the .db files
if [ "$LOWRESSOURCES" = "0" ]
then
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/adult/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/adult/urls
fi
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/warez/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/warez/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/forums/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/forums/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/publicite/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/publicite/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/academie/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/academie/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/agressif/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/agressif/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/drogue/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/drogue/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/tricheur/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/tricheur/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/redirector/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/redirector/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/strict_redirector/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/strict_redirector/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/radio/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/mobile-phone/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/mobile-phone/urls
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/webmail/domains
/usr/local/squid/bin/squidGuard -C /usr/local/squid/squidGuard/db/webmail/urls
logger -t "$LOGTAG" "Restarting proxy."
killall -HUP squid
logger -t "$LOGTAG" "UPDATE URL BLACKLISTS: end"
fi
###
##############################
logger -t "$LOGTAG" "$SCRIPT_STATUS_MSG: successed."
rm -f $LOCKFILE