wok-current view squidanalyzer/receipt @ rev 24958

updated nbd (3.20 -> 3.24)
author Hans-G?nter Theisgen
date Sat Apr 23 16:50:32 2022 +0100 (2022-04-23)
parents 5ea0ce1cecc0
children
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="https://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 current_version()
20 {
21 wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \
22 sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q'
23 }
25 # Rules to configure and make the package.
26 compile_rules()
27 {
28 perl Makefile.PL INSTALLDIRS=site
29 make &&
30 make DESTDIR=$DESTDIR install
31 }
33 # Rules to gen a SliTaz package suitable for Tazpkg.
34 genpkg_rules()
35 {
36 mkdir -p $fs/usr
37 cp -a $install/usr/bin $fs/usr
38 cp -a $install/usr/lib $fs/usr
39 cp -a $install/var $fs
40 chown -R 80.80 $fs/var/www/squidanalyzer
41 cp -a $install/etc $fs
42 mkdir $fs/etc/initcron.d
43 cat > $fs/etc/initcron.d/squidanalyzer <<EOT
45 # SquidAnalyzer log reporting daily
46 0 2 * * * /usr/bin/squid-analyzer > /dev/null 2>&1
47 EOT
48 chmod +x $fs/etc/initcron.d/squidanalyzer
49 }
51 # Pre and post install commands for Tazpkg.
52 pre_remove()
53 {
54 if [ -z "$1" ]; then
55 crontab -l 2> /dev/null | grep -q squidanalyzer || crontab - << EOT
56 $(crontab -l 2> /dev/null | sed '/SquidAnalyzer/d;/squid-analyzer/d')
57 EOT
58 fi
59 }
61 post_install()
62 {
63 if [ -z "$1" ]; then
64 crontab -l 2> /dev/null | grep -q squidanalyzer || crontab - << EOT
65 $(crontab -l 2> /dev/null)
66 $(cat /etc/initcron.d/squidanalyzer)
67 EOT
68 chmod -x /etc/initcron.d/squidanalyzer
69 fi
70 if [ -d $1/etc/logrotate.d -a
71 -z "$(ls $1/etc/logrotate.d | grep squid)" ]; then
72 cat > $1/etc/logrotate.d/squidanalyzer <<EOT
73 /var/log/proxy/squid-access.log {
74 daily
75 compress
76 rotate 730
77 missingok
78 nocreate
79 sharedscripts
80 postrotate
81 test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
82 /usr/bin/squid-analyzer -d -l /var/log/proxy/squid-access.log.1
83 endscript
84 }
85 EOT
86 fi
87 }