wok-current view squidanalyzer/receipt @ rev 23806

linld: add isoboot
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun May 24 16:16:52 2020 +0000 (2020-05-24)
parents
children 5ea0ce1cecc0
line source
1 # SliTaz package receipt.
3 PACKAGE="squidanalyzer"
4 VERSION="6.6"
5 CATEGORY="network"
6 SHORT_DESC="Squid proxy native log analyser and reports generator"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL3"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://squidanalyzer.darold.net/"
11 WGET_URL="https://github.com/darold/squidanalyzer/archive/v$VERSION.tar.gz"
12 CONFIG_FILES="/etc/squidanalyzer"
13 TAGS="logs"
15 DEPENDS="perl squid"
16 BUILD_DEPENDS="perl"
17 SUGGESTED="logrotate"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 perl Makefile.PL INSTALLDIRS=site
23 make &&
24 make DESTDIR=$DESTDIR install
25 }
27 # Rules to gen a SliTaz package suitable for Tazpkg.
28 genpkg_rules()
29 {
30 mkdir -p $fs/usr
31 cp -a $install/usr/bin $fs/usr
32 cp -a $install/usr/lib $fs/usr
33 cp -a $install/var $fs
34 chown -R 80.80 $fs/var/www/squidanalyzer
35 cp -a $install/etc $fs
36 mkdir $fs/etc/initcron.d
37 cat > $fs/etc/initcron.d/squidanalyzer <<EOT
39 # SquidAnalyzer log reporting daily
40 0 2 * * * /usr/bin/squid-analyzer > /dev/null 2>&1
41 EOT
42 chmod +x $fs/etc/initcron.d/squidanalyzer
43 }
45 # Pre and post install commands for Tazpkg.
46 pre_remove()
47 {
48 if [ -z "$1" ]; then
49 crontab -l 2> /dev/null | grep -q squidanalyzer || crontab - << EOT
50 $(crontab -l 2> /dev/null | sed '/SquidAnalyzer/d;/squid-analyzer/d')
51 EOT
52 fi
53 }
55 post_install()
56 {
57 if [ -z "$1" ]; then
58 crontab -l 2> /dev/null | grep -q squidanalyzer || crontab - << EOT
59 $(crontab -l 2> /dev/null)
60 $(cat /etc/initcron.d/squidanalyzer)
61 EOT
62 chmod -x /etc/initcron.d/squidanalyzer
63 fi
64 if [ -d $1/etc/logrotate.d -a
65 -z "$(ls $1/etc/logrotate.d | grep squid)" ]; then
66 cat > $1/etc/logrotate.d/squidanalyzer <<EOT
67 /var/log/proxy/squid-access.log {
68 daily
69 compress
70 rotate 730
71 missingok
72 nocreate
73 sharedscripts
74 postrotate
75 test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
76 /usr/bin/squid-analyzer -d -l /var/log/proxy/squid-access.log.1
77 endscript
78 }
79 EOT
80 fi
81 }