wok-current view awstats/receipt @ rev 24447

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 14 17:51:14 2022 +0000 (2022-02-14)
parents 5836340a00c2
children
line source
1 # SliTaz package receipt.
3 PACKAGE="awstats"
4 VERSION="7.8"
5 CATEGORY="network"
6 TAGS="log analysis web mail ftp"
7 SHORT_DESC="Log file analyzer."
8 MAINTAINER="erjo@slitaz.org"
9 LICENSE="GPL"
10 WEB_SITE="https://www.awstats.org/"
12 TARBALL="$PACKAGE-$VERSION.tar.gz"
13 WGET_URL="${WEB_SITE}files/$TARBALL"
15 SUGGESTED="perl-geo-ipfree perl-net-xwhois"
16 DEPENDS="perl"
18 # What is the latest version available today?
19 current_version()
20 {
21 wget -O - $WEB_SITE 2>/dev/null | \
22 sed '/^Last stable/!d;s|.*<b>||;s|<.*||;q'
23 }
25 # Rules to gen a SliTaz package suitable for Tazpkg.
26 genpkg_rules()
27 {
28 mkdir -p $fs/usr/share/awstats/extras
29 mkdir -p $fs/var/www/cgi-bin
30 mkdir -p $fs/var/lib/awstats
31 mkdir -p $fs/etc/awstats
32 mkdir -p $install/usr/share
34 cp -a $src/docs $install/usr/share/doc
35 cp -a $src/wwwroot/classes $fs/usr/share/awstats
36 cp -a $src/wwwroot/css $fs/usr/share/awstats
37 cp -a $src/wwwroot/icon $fs/usr/share/awstats
38 cp -a $src/wwwroot/js $fs/usr/share/awstats
39 cp -a $src/wwwroot/cgi-bin/lang $fs/usr/share/awstats
40 cp -a $src/wwwroot/cgi-bin/lib $fs/usr/share/awstats
41 cp -a $src/wwwroot/cgi-bin/plugins $fs/usr/share/awstats
43 cp -a $src/wwwroot/cgi-bin/awstats.pl $fs/var/www/cgi-bin
44 cp -a $src/wwwroot/cgi-bin/awstats.model.conf \
45 $fs/etc/awstats
47 cp $stuff/* $fs/usr/share/awstats/extras
49 # Add a link using google map
50 sed -i 's|Full Whois Field"|Full Whois Field <a href=\\"http://en.utrace.de/?query=".$HostResolved."\\">?</a>"|' \
51 $fs/usr/share/awstats/plugins/hostinfo.pm
53 # Avoid alias conflicts
54 for i in classes css icon
55 do
56 sed -i "s| /$i| /awstats$i|" \
57 $fs/usr/share/awstats/extras/awstats-apache.conf
58 sed -i "s|\"/$i|\"/awstats$i|" \
59 $fs/usr/share/awstats/extras/awstats-lighttpd.conf
60 done
61 sed -i -e '/\/css\//d' -e 's|DirIcons="/icon"|DirIcons="/awstatsicon"|' \
62 $fs/etc/awstats/awstats.model.conf
63 sed -i 's/classes/awstatsclasses/' \
64 $fs/usr/share/awstats/plugins/graphapplet.pm
66 chown -R root:root $fs
67 find $fs -type f -exec chmod a-x \{\} \;
69 chmod a+x $fs/usr/share/awstats/classes/src/Makefile.pl
70 chmod a+x $fs/usr/share/awstats/extras/update
71 chmod a+x $fs/var/www/cgi-bin/awstats.pl
72 }
74 post_install()
75 {
76 # Set lighttpd or apache config
77 if [ -f "$1/etc/apache/httpd.conf" ]
78 then
79 if [ ! -f "$1/etc/apache/conf.d/awstats.conf" ]
80 then
81 cp "$1/usr/share/awstats/extras/awstats-apache.conf" \
82 "$1/etc/apache/conf.d/awstats.conf"
83 fi
84 if [ -z "$1" ]
85 then
86 # Start Web server if necessary.
87 if [ -f /var/run/apache/httpd.pid ]
88 then
89 /etc/init.d/apache restart
90 fi
91 fi
92 fi
94 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]
95 then
96 if [ ! -f "$1/etc/lighttpd/awstats.conf" ]
97 then
98 cp "$1/usr/share/awstats/extras/awstats-lighttpd.conf" \
99 "$1/etc/lighttpd/awstats.conf"
100 fi
101 # Start Web server if necessary.
102 if [ -f /var/run/lighttpd.pid ]
103 then
104 /etc/init.d/lighttpd restart
105 fi
106 fi
107 [ "$quiet" ] || cat <<EOT
109 You should add in your crontab something like;
111 0 0 * * * /usr/share/awstats/extras/update
112 EOT
113 }
115 post_remove()
116 {
117 echo "Remove orphan dirctories."
118 [ -d /usr/share/awstats ] &&
119 rm -rf /usr/share/awstats
121 # FIXME
122 echo "All database and configuratoin files will be removed"
123 echo -n "Please confirm removing (y/N) : "
124 read answer
126 case $answer in
127 (y|Y)
128 rm -rf /var/lib/awstats
129 rm -rf /etc/awstats
130 ;;
131 (*)
132 ;;
133 esac
134 }