wok view squidanalyzer/receipt @ rev 25682
Up libqcow (20240308)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 24 18:25:46 2024 +0000 (7 months ago) |
parents | 28a7087bc745 |
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 # What is the latest version available today?
20 current_version()
21 {
22 wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \
23 sed '/tag\//!d;s|.*tag/v*||;s|".*||;q'
24 }
26 # Rules to configure and make the package.
27 compile_rules()
28 {
29 perl Makefile.PL INSTALLDIRS=site
30 make &&
31 make DESTDIR=$DESTDIR install
32 }
34 # Rules to gen a SliTaz package suitable for Tazpkg.
35 genpkg_rules()
36 {
37 mkdir -p $fs/usr
38 cp -a $install/usr/bin $fs/usr
39 cp -a $install/usr/lib $fs/usr
40 cp -a $install/var $fs
41 chown -R 80.80 $fs/var/www/squidanalyzer
42 cp -a $install/etc $fs
43 mkdir $fs/etc/initcron.d
44 cat > $fs/etc/initcron.d/squidanalyzer <<EOT
46 # SquidAnalyzer log reporting daily
47 0 2 * * * /usr/bin/squid-analyzer > /dev/null 2>&1
48 EOT
49 chmod +x $fs/etc/initcron.d/squidanalyzer
50 }
52 # Pre and post install commands for Tazpkg.
53 pre_remove()
54 {
55 if [ -z "$1" ]; then
56 crontab -l 2> /dev/null | grep -q squidanalyzer || crontab - << EOT
57 $(crontab -l 2> /dev/null | sed '/SquidAnalyzer/d;/squid-analyzer/d')
58 EOT
59 fi
60 }
62 post_install()
63 {
64 if [ -z "$1" ]; then
65 crontab -l 2> /dev/null | grep -q squidanalyzer || crontab - << EOT
66 $(crontab -l 2> /dev/null)
67 $(cat /etc/initcron.d/squidanalyzer)
68 EOT
69 chmod -x /etc/initcron.d/squidanalyzer
70 fi
71 if [ -d $1/etc/logrotate.d -a
72 -z "$(ls $1/etc/logrotate.d | grep squid)" ]; then
73 cat > $1/etc/logrotate.d/squidanalyzer <<EOT
74 /var/log/proxy/squid-access.log {
75 daily
76 compress
77 rotate 730
78 missingok
79 nocreate
80 sharedscripts
81 postrotate
82 test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
83 /usr/bin/squid-analyzer -d -l /var/log/proxy/squid-access.log.1
84 endscript
85 }
86 EOT
87 fi
88 }