squidclamav: Update squidclamav.conf to use and trust the proxy cache.
[people/teissler/ipfire-2.x.git] / src / paks / squidclamav / update.sh
1 #!/bin/bash
2 ############################################################################
3 # #
4 # This file is part of the IPFire Firewall. #
5 # #
6 # IPFire is free software; you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation; either version 2 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # IPFire is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with IPFire; if not, write to the Free Software #
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
19 # #
20 # Copyright (C) 2010 IPFire-Team <info@ipfire.org>. #
21 # #
22 ############################################################################
23 #
24 . /opt/pakfire/lib/functions.sh
25 ./uninstall.sh
26 extract_files
27
28 VERSION=$(cat /opt/pakfire/db/installed/meta-squidclamav | grep Release | cut -d" " -f2)
29
30 if [ "$VERSION" -gt "10" ]; then
31 restore_backup ${NAME}
32 fi
33
34 if [ "$VERSION" -lt "11" ]; then
35 sed -e "s|logfile.*|logfile /var/log/squid/squidclamav.log|g" /etc/squidclamav.conf
36 fi
37
38 if [ "$VERSION" -lt "16" ]; then
39 sed -e "s/proxy none//g" -i /etc/squidclamav.conf
40 sed -e "s/^#squid_ip 127\.0\.0\.1/squid_ip 127\.0\.0\.1/g" \
41 -e "s/^#squid_port 3128/squid_port 800/g" \
42 -e "s/^#trust_cache 1/trust_cache 1/g" -i /etc/squidclamav.conf
43
44 # Regenerate configuration files.
45 perl /srv/web/ipfire/cgi-bin/proxy.cgi
46 fi
47
48 /etc/init.d/squid restart