wok-6.x annotate squidguardmgr/receipt @ rev 18730

Quote root dir in post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 20 15:13:45 2015 +0100 (2015-12-20)
parents 3d805214d753
children 46dcc80bef41
rev   line source
pascal@9982 1 # SliTaz package receipt.
pascal@9982 2
pascal@9982 3 PACKAGE="squidguardmgr"
erjo@14814 4 VERSION="1.12"
pascal@9982 5 CATEGORY="system-tools"
pascal@9982 6 SHORT_DESC="Web GUI for squidGuard and SquidClamav administration."
pascal@9982 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15582 8 LICENSE="GPL3"
pascal@9982 9 TARBALL="$PACKAGE-$VERSION.tar.gz"
pascal@9982 10 WEB_SITE="http://squidguardmgr.sourceforge.net/"
pascal@9982 11 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
pascal@9982 12 DEPENDS="squidguard squidclamav lighttpd"
erjo@14814 13 BUILD_DEPENDS="perl squidguard "
pascal@9982 14 CONFIG_FILES="/etc/squidguardmgr.conf"
pascal@9982 15
pascal@9982 16 # Rules to configure and make the package.
pascal@9982 17 compile_rules()
pascal@9982 18 {
pascal@9982 19 cd $src
erjo@14814 20 SQUIDUSR=squid SQUIDGRP=squid perl Makefile.PL << EOT &&
pascal@9982 21 /etc/squidGuard/squidGuard.conf
pascal@9982 22 nobody
pascal@9982 23 EOT
pascal@10483 24 mkdir -p $DESTDIR/var/www/squidguardmgr/ &&
pascal@9982 25 make install
pascal@9982 26 }
pascal@9982 27
pascal@9982 28 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@9982 29 genpkg_rules()
pascal@9982 30 {
erjo@14814 31 mkdir -p $fs/usr/share $fs/etc $fs/var/lib/squidGuard/log $fs/var/lib/squidGuard/db
erjo@14814 32
pascal@15582 33 cp -a $install/var/www/squidguardmgr $fs/usr/share
erjo@14814 34 ( cd $fs ; patch -p0 ) < $stuff/squidguardmgr.U
erjo@14814 35 mv $fs/usr/share/squidguardmgr/squidguardmgr.conf $fs/etc
pascal@9982 36 ln -s /etc/squidguardmgr.conf $fs/usr/share/squidguardmgr/squidguardmgr.conf
erjo@14814 37
erjo@14814 38 sed -i -e 's|/var/www/squidguardmgr|/usr/share/squidguardmgr|' \
erjo@14814 39 -e 's|SQUIDCLAMAV off|SQUIDCLAMAV on|' \
erjo@14814 40 -e 's|SC_CONF_FILE|SC_CONF_FILE /etc/squidclamav.conf|' \
erjo@14814 41 -e 's|C_ICAP_SOCKET|C_ICAP_SOCKET /var/run/c-icap/c-icap.ctl|' $fs/etc/squidguardmgr.conf
pascal@9982 42 }
pascal@9982 43
pascal@9982 44 post_install()
pascal@9982 45 {
pascal@9982 46 # squidguardmgr config
pascal@18730 47 chown root.www "$1/etc/squidGuard/squidGuard.conf"
pascal@18730 48 chmod 664 "$1/etc/squidGuard/squidGuard.conf"
pascal@18730 49 chown nobody.nogroup "$1"/usr/share/squidguardmgr/lang/* \
pascal@18730 50 "$1/usr/share/squidguardmgr/lang" "$1/usr/share/squidguardmgr"
pascal@9982 51 # Configure lighttpd server
pascal@18730 52 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
pascal@18730 53 if ! grep -q /usr/share/squidguardmgr/ "$1/etc/lighttpd/lighttpd.conf"; then
pascal@18730 54 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/squidguardmgr/" => "/usr/share/squidguardmgr/",|g' -i "$1/etc/lighttpd/lighttpd.conf"
pascal@9982 55 if [ -z "$1" ]; then
pascal@9982 56 # Start Web server.
pascal@9982 57 /etc/init.d/lighttpd stop
pascal@9982 58 /etc/init.d/lighttpd start
pascal@9982 59 fi
pascal@9982 60 fi
pascal@9982 61 fi
pascal@9982 62 # Configure apache server
pascal@18730 63 if [ -f "$1/etc/apache/httpd.conf" ]; then
pascal@18730 64 if [ ! -f "$1/etc/apache/conf.d/squidguardmgr" ]; then
pascal@18730 65 cat > "$1/etc/apache/conf.d/squidguardmgr" <<EOT
pascal@9982 66 <IfModule mod_alias.c>
pascal@9982 67 Alias /squidguardmgr /usr/share/squidguardmgr
pascal@9982 68 </IfModule>
pascal@9982 69 <DirectoryMatch /usr/share/squidguardmgr/>
pascal@9982 70 Options +ExecCGI
pascal@9982 71 AddHandler cgi-script .cgi
pascal@9982 72 DirectoryIndex squidguardmgr.cgi
pascal@9982 73 Order allow,deny
pascal@9982 74 Allow from all
pascal@9982 75 </DirectoryMatch>
pascal@9982 76 EOT
pascal@9982 77 if [ -z "$1" ]; then
pascal@9982 78 # Start Web server.
pascal@9982 79 /etc/init.d/apache stop
pascal@9982 80 /etc/init.d/apache start
pascal@9982 81 fi
pascal@9982 82 fi
pascal@9982 83 fi
pascal@9982 84 }