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