wok-current rev 2334

squidguard: relocate configfile, add post_remove function, restart squid after install/remove package.
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Sun Mar 01 08:53:15 2009 +0100 (2009-03-01)
parents 0c8bdacb8fb2
children 76990ad741d7
files squidguard/receipt
line diff
     1.1 --- a/squidguard/receipt	Sun Mar 01 03:03:59 2009 +0100
     1.2 +++ b/squidguard/receipt	Sun Mar 01 08:53:15 2009 +0100
     1.3 @@ -17,18 +17,18 @@
     1.4  {
     1.5  	cd $src
     1.6  	./configure --prefix=/usr --infodir=/usr/share/info \
     1.7 -	--sysconfdir=/etc --with-sg-config=/etc/squid/squidGuard.conf \
     1.8 +	--sysconfdir=/etc --with-sg-config=/etc/squidGuard/squidGuard.conf \
     1.9  	--with-sg-logdir=/var/lib/squidGuard/log \
    1.10  	--with-sg-dbhome=/var/lib/squidGuard/db \
    1.11  	--mandir=/usr/share/man $CONFIGURE_ARGS
    1.12  	make
    1.13  	sed -e 's|^prefix =.*|prefix = _pkg/usr|' \
    1.14  	    -e 's|^logdir =.*|logdir = _pkg/var/lib/squidGuard/log|' \
    1.15 -	    -e 's|^configfile =.*|configfile = _pkg/etc/squid/squidGuard.conf|' \
    1.16 +	    -e 's|^configfile =.*|configfile = _pkg/etc/squidGuard/squidGuard.conf|' \
    1.17  	    -e 's|^dbhomedir =.*|dbhomedir = _pkg/var/lib/squidGuard/db|' \
    1.18 -	    -e 's|^SQUIDUSER =.*|SQUIDUSER = root|' \
    1.19 +	    -e 's|^SQUIDUSER =.*|SQUIDUSER = nobody|' \
    1.20  	    < Makefile > Makefile.slitaz-install
    1.21 -	mkdir -p _pkg/etc/squid
    1.22 +	mkdir -p _pkg/etc/squidGuard
    1.23  	make -f Makefile.slitaz-install install
    1.24  }
    1.25  
    1.26 @@ -41,11 +41,23 @@
    1.27  # Pre and post install commands for Tazpkg.
    1.28  post_install()
    1.29  {
    1.30 -	chown -R nobody /var/lib/squidGuard/* /usr/squidGuard
    1.31 -	if ! grep ^redirect_program $1/etc/squid/squid.conf ; then
    1.32 +	chown -R nobody $1/var/lib/squidGuard/* $1/usr/squidGuard
    1.33 +	if ! grep -q ^redirect_program $1/etc/squid/squid.conf ; then
    1.34  		echo "Updating /etc/squid/squid.conf"
    1.35  		cat >> $1/etc/squid/squid.conf <<EOF
    1.36 -redirect_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf
    1.37 +redirect_program /usr/bin/squidGuard -c /etc/squidGuard/squidGuard.conf
    1.38  EOF
    1.39 +		# Restart squid if running
    1.40 +		$(which squid) -k reconfigure 2> /dev/null
    1.41  	fi
    1.42  }
    1.43 +
    1.44 +post_remove()
    1.45 +{
    1.46 +	if grep -q "squidGuard" 	/etc/squid/squid.conf ; then
    1.47 +		echo "Updating /etc/squid/squid.conf"
    1.48 +		sed -i -e "s/.*squidGuard.*//" /etc/squid/squid.conf
    1.49 +		# Restart squid if running
    1.50 +		$(which squid) -k reconfigure 2> /dev/null
    1.51 +	fi
    1.52 +}