wok-current annotate squidguard/receipt @ rev 18732

Quote root dir in post_install (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 21 00:07:14 2015 +0100 (2015-12-21)
parents 9e01bc6321ea
children be2ab6ab8f7e
rev   line source
pascal@1253 1 # SliTaz package receipt.
pascal@1253 2
pascal@1253 3 PACKAGE="squidguard"
erjo@3985 4 VERSION="1.4"
pascal@1253 5 CATEGORY="network"
pascal@1253 6 SHORT_DESC="Web filter."
pascal@1253 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15023 8 LICENSE="GPL"
pascal@1253 9 SOURCE="squidGuard"
pascal@1253 10 TARBALL="$SOURCE-$VERSION.tar.gz"
pascal@1253 11 WEB_SITE="http://www.squidguard.org/"
pascal@1253 12 WGET_URL="${WEB_SITE}Downloads/$TARBALL"
pascal@1253 13 DEPENDS="squid libdb"
pascal@1253 14 BUILD_DEPENDS="db-dev"
pascal@1253 15
pascal@1253 16 # Rules to configure and make the package.
pascal@1253 17 compile_rules()
pascal@1253 18 {
pascal@1253 19 cd $src
erjo@4661 20
erjo@4661 21 # Security patches
erjo@4661 22 while read patch_file; do
erjo@4661 23 echo "Apply $patch_file"
pascal@8974 24 tar xvzf $stuff/$patch_file || return 1
erjo@4661 25 cp -a $(basename $patch_file .tar.gz)/* src
erjo@4661 26 done <<EOT
erjo@4661 27 squidGuard-1.4-patch-20091015.tar.gz
erjo@4661 28 squidGuard-1.4-patch-20091019.tar.gz
pascal@18170 29 squidGuard-1.4-patch-20150201.tar.gz
erjo@4661 30 EOT
erjo@16708 31 # Add support for squid 3.4
erjo@16708 32 patch -p1 < $stuff/squidGuard-1.4_upgrade.patch
erjo@16708 33 patch -p1 < $stuff/squidGuard-1.4-dnsbl.patch
erjo@16708 34
pascal@1253 35 ./configure --prefix=/usr --infodir=/usr/share/info \
erjo@2334 36 --sysconfdir=/etc --with-sg-config=/etc/squidGuard/squidGuard.conf \
pascal@1253 37 --with-sg-logdir=/var/lib/squidGuard/log \
pascal@1253 38 --with-sg-dbhome=/var/lib/squidGuard/db \
pascal@1253 39 --mandir=/usr/share/man $CONFIGURE_ARGS
erjo@4661 40
pascal@1253 41 make
pascal@15603 42 sed -e "s|^prefix =.*|prefix = $DESTDIR/usr|" \
pascal@15603 43 -e "s|^logdir =.*|logdir = $DESTDIR/var/lib/squidGuard/log|" \
pascal@15603 44 -e "s|^configfile =.*|configfile = $DESTDIR/etc/squidGuard/squidGuard.conf|" \
pascal@15603 45 -e "s|^dbhomedir =.*|dbhomedir = $DESTDIR/var/lib/squidGuard/db|" \
pascal@15603 46 -e "s|^SQUIDUSER =.*|SQUIDUSER = nobody|" \
pascal@1253 47 < Makefile > Makefile.slitaz-install
pascal@15603 48 mkdir -p $DESTDIR/etc/squidGuard
pascal@1253 49 make -f Makefile.slitaz-install install
pascal@1253 50 }
pascal@1253 51
pascal@1253 52 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1253 53 genpkg_rules()
pascal@1253 54 {
erjo@11916 55 mkdir -p $fs/etc/squid/conf.d
erjo@11916 56
erjo@11916 57 cp -a $install/* $fs/
erjo@11916 58 cp -pa $stuff/squidguard.conf $fs/etc/squid/conf.d
erjo@11916 59
erjo@11916 60 # Cleanup.
pascal@3990 61 rmdir $fs/usr/squidGuard
erjo@11916 62
pascal@1253 63 }
pascal@1253 64
pascal@1253 65 # Pre and post install commands for Tazpkg.
pascal@1253 66 post_install()
pascal@1253 67 {
pascal@18730 68 chown -R nobody "$1"/var/lib/squidGuard/*
erjo@11916 69 # Recharge squid config
pascal@18732 70 [ "$1" ] || { [ -x $(which squid) ] && $(which squid) -k reconfigure 2> /dev/null; }
pascal@1253 71 }
erjo@2334 72
erjo@2334 73 post_remove()
erjo@2334 74 {
erjo@11916 75 # Recharge squid config
pascal@18732 76 [ "$1" ] || { [ -x $(which squid) ] && $(which squid) -k reconfigure 2> /dev/null; }
erjo@2334 77 }
pascal@18170 78
pascal@18170 79 check_config()
pascal@18170 80 {
pascal@18174 81 su -c 'echo "http://www.example.com 192.168.0.6/- - GET" | \
pascal@18174 82 squidGuard -c /etc/squidGuard/squidGuard.conf -d' nobody
pascal@18170 83 }