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