wok-6.x rev 22810
Add squidanalyser
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Jan 31 12:24:59 2020 +0100 (2020-01-31) |
parents | e2f8a574b574 |
children | 8dd591a23c39 |
files | squidanalyser/receipt webalizer/receipt |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/squidanalyser/receipt Fri Jan 31 12:24:59 2020 +0100 1.3 @@ -0,0 +1,81 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="squidanalyser" 1.7 +VERSION="6.6" 1.8 +CATEGORY="network" 1.9 +SHORT_DESC="Squid proxy native log analyser and reports generator" 1.10 +MAINTAINER="pascal.bellard@slitaz.org" 1.11 +LICENSE="GPL3" 1.12 +TARBALL="$PACKAGE-$VERSION.tar.gz" 1.13 +WEB_SITE="http://squidanalyzer.darold.net/" 1.14 +WGET_URL="https://github.com/darold/squidanalyzer/archive/v$VERSION.tar.gz" 1.15 +CONFIG_FILES="/etc/squidanalyzer" 1.16 +TAGS="logs" 1.17 + 1.18 +DEPENDS="perl squid" 1.19 +BUILD_DEPENDS="perl" 1.20 +SUGGESTED="logrotate" 1.21 + 1.22 +# Rules to configure and make the package. 1.23 +compile_rules() 1.24 +{ 1.25 + perl Makefile.PL INSTALLDIRS=site 1.26 + make && 1.27 + make DESTDIR=$DESTDIR install 1.28 +} 1.29 + 1.30 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.31 +genpkg_rules() 1.32 +{ 1.33 + mkdir -p $fs/usr 1.34 + cp -a $install/usr/bin $fs/usr 1.35 + cp -a $install/usr/lib $fs/usr 1.36 + cp -a $install/var $fs 1.37 + chown -R 80.80 $fs/var/www/squidanalyser 1.38 + cp -a $install/etc $fs 1.39 + mkdir $fs/etc/initcron.d 1.40 + cat > $fs/etc/initcron.d/squidanalyser <<EOT 1.41 + 1.42 +# SquidAnalyzer log reporting daily 1.43 +0 2 * * * /usr/bin/squid-analyzer > /dev/null 2>&1 1.44 +EOT 1.45 + chmod +x $fs/etc/initcron.d/squidanalyser 1.46 +} 1.47 + 1.48 +# Pre and post install commands for Tazpkg. 1.49 +pre_remove() 1.50 +{ 1.51 + if [ -z "$1" ]; then 1.52 + crontab -l 2> /dev/null | grep -q squidanalyser || crontab - << EOT 1.53 +$(crontab -l 2> /dev/null | sed '/SquidAnalyzer/d;/squid-analyzer/d') 1.54 +EOT 1.55 + fi 1.56 +} 1.57 + 1.58 +post_install() 1.59 +{ 1.60 + if [ -z "$1" ]; then 1.61 + crontab -l 2> /dev/null | grep -q squidanalyser || crontab - << EOT 1.62 +$(crontab -l 2> /dev/null) 1.63 +$(cat /etc/initcron.d/squidanalyser) 1.64 +EOT 1.65 + chmod -x /etc/initcron.d/squidanalyser 1.66 + fi 1.67 + if [ -d $1/etc/logrotate.d -a 1.68 + -z "$(ls $1/etc/logrotate.d | grep squid)" ]; then 1.69 + cat > $1/etc/logrotate.d/squidanalyser <<EOT 1.70 +/var/log/proxy/squid-access.log { 1.71 + daily 1.72 + compress 1.73 + rotate 730 1.74 + missingok 1.75 + nocreate 1.76 + sharedscripts 1.77 + postrotate 1.78 + test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate 1.79 + /usr/bin/squid-analyzer -d -l /var/log/proxy/squid-access.log.1 1.80 + endscript 1.81 +} 1.82 +EOT 1.83 + fi 1.84 +}
2.1 --- a/webalizer/receipt Thu Jan 30 09:57:32 2020 +0100 2.2 +++ b/webalizer/receipt Fri Jan 31 12:24:59 2020 +0100 2.3 @@ -50,6 +50,17 @@ 2.4 } 2.5 2.6 # Pre and post install commands for Tazpkg. 2.7 +pre_remove() 2.8 +{ 2.9 + sed -i '/webalizer/d' "$1/etc/init.d/local.sh" 2.10 + if [ -z "$1" ] 2.11 + then 2.12 + crontab -l 2> /dev/null | grep -q webalizer || crontab - << EOT 2.13 +$(crontab -l 2> /dev/null | grep -v webalizer) 2.14 +EOT 2.15 + fi 2.16 +} 2.17 + 2.18 post_install() 2.19 { 2.20 grep -q webalizer "$1/etc/init.d/local.sh" || \ 2.21 @@ -64,5 +75,6 @@ 2.22 $(crontab -l 2> /dev/null) 2.23 $(cat /etc/initcron.d/webalizer) 2.24 EOT 2.25 + chmod -x /etc/initcron.d/webalizer 2.26 fi 2.27 }