wok-next view awstats/receipt @ rev 21017
Some maintenance
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Oct 16 16:46:05 2018 +0300 (2018-10-16) |
parents | 86b5d202495a |
children | d5aab818505e |
line source
1 # SliTaz package receipt v2.
3 PACKAGE="awstats"
4 VERSION="7.0"
5 CATEGORY="network"
6 SHORT_DESC="Log file analyzer"
7 MAINTAINER="erjo@slitaz.org"
8 LICENSE="GPL"
9 WEB_SITE="http://awstats.sourceforge.net/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
14 compile_rules() {
15 mkdir -p \
16 $install/usr/share/awstats/extras/ \
17 $install/var/www/cgi-bin/ \
18 $install/var/lib/awstats/ \
19 $install/etc/awstats/
21 cp -r wwwroot/classes $install/usr/share/awstats/
22 cp -r wwwroot/css $install/usr/share/awstats/
23 cp -r wwwroot/icon $install/usr/share/awstats/
24 cp -r wwwroot/js $install/usr/share/awstats/
25 cp -r wwwroot/cgi-bin/lang $install/usr/share/awstats/
26 cp -r wwwroot/cgi-bin/lib $install/usr/share/awstats/
27 cp -r wwwroot/cgi-bin/plugins $install/usr/share/awstats/
29 cp -r wwwroot/cgi-bin/awstats.pl $install/var/www/cgi-bin/
30 cp -r wwwroot/cgi-bin/awstats.model.conf $install/etc/awstats/
32 cp $stuff/* $install/usr/share/awstats/extras/
34 # Add a link using Google map
35 sed -i 's|Full Whois Field"|Full Whois Field <a href=\\"http://en.utrace.de/?query=".$HostResolved."\\">?</a>"|' \
36 $install/usr/share/awstats/plugins/hostinfo.pm
38 # Avoid alias conflicts
39 for i in classes css icon; do
40 sed -i "s| /$i| /awstats$i|" \
41 $install/usr/share/awstats/extras/awstats-apache.conf
42 sed -i "s|\"/$i|\"/awstats$i|" \
43 $install/usr/share/awstats/extras/awstats-lighttpd.conf
44 done
45 sed -i '/\/css\//d; s|DirIcons="/icon"|DirIcons="/awstatsicon"|' \
46 $install/etc/awstats/awstats.model.conf
47 sed -i 's|classes|awstatsclasses|' \
48 $install/usr/share/awstats/plugins/graphapplet.pm
50 chown -R root:root $install
51 find $install -type f -exec chmod a-x '{}' \;
52 chmod a+x \
53 $install/usr/share/awstats/extras/update \
54 $install/var/www/cgi-bin/awstats.pl \
55 $install/usr/share/awstats/classes/src/Makefile.pl
56 }
58 genpkg_rules() {
59 copy @std
60 DEPENDS="perl"
61 SUGGESTED="perl-net-xwhois perl-geo-ipfree"
62 TAGS="log analysis web mail ftp"
63 }
65 post_install() {
66 # Set lighttpd or apache config
67 if [ -f "$1/etc/apache/httpd.conf" ]; then
68 if [ ! -f "$1/etc/apache/conf.d/awstats.conf" ]; then
69 cp "$1/usr/share/awstats/extras/awstats-apache.conf" \
70 "$1/etc/apache/conf.d/awstats.conf"
71 fi
72 if [ -z "$1" ]; then
73 # Start Web server if necessary.
74 if [ -f /var/run/apache/httpd.pid ]; then
75 /etc/init.d/apache restart
76 fi
77 fi
78 fi
80 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
81 if [ ! -f "$1/etc/lighttpd/awstats.conf" ]; then
82 cp "$1/usr/share/awstats/extras/awstats-lighttpd.conf" \
83 "$1/etc/lighttpd/awstats.conf"
84 fi
85 # Start Web server if necessary.
86 if [ -f /var/run/lighttpd.pid ]; then
87 /etc/init.d/lighttpd restart
88 fi
89 fi
91 [ -n "$quiet" ] || cat <<EOT
93 .-----------------------------------------------.
94 | You should add in your crontab something like |
95 | |
96 | 0 0 * * * /usr/share/awstats/extras/update |
97 '-----------------------------------------------'
98 EOT
99 }
101 post_remove() {
102 # Remove orphan directories
103 [ -d "$1/usr/share/awstats" ] && rm -rf "$1/usr/share/awstats"
105 # FIXME
106 echo "All database and configuration files will be removed"
107 echo -n "Please confirm removing (y/N) : "; read answer
109 case $answer in
110 y|Y) rm -rf "$1/var/lib/awstats" "$1/etc/awstats";;
111 esac
112 }