wok-next view awstats/receipt @ rev 18730

Quote root dir in post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 20 15:13:45 2015 +0100 (2015-12-20)
parents 1067bb7f1e24
children a6f7b6b890c2
line source
1 # SliTaz package receipt.
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/"
10 TARBALL="$PACKAGE-$VERSION.tar.gz"
11 WGET_URL="http://prdownloads.sourceforge.net/awstats/$TARBALL"
12 TAGS="log analyze web mail ftp"
14 DEPENDS="perl"
15 SUGGESTED="perl-net-xwhois"
17 # Rules to gen a SliTaz package suitable for Tazpkg.
18 genpkg_rules()
19 {
20 mkdir -p $fs/usr/share/awstats/extras \
21 $fs/var/www/cgi-bin \
22 $fs/var/lib/awstats \
23 $fs/etc/awstats \
25 cp -a $src/wwwroot/classes $fs/usr/share/awstats
26 cp -a $src/wwwroot/css $fs/usr/share/awstats
27 cp -a $src/wwwroot/icon $fs/usr/share/awstats
28 cp -a $src/wwwroot/js $fs/usr/share/awstats
29 cp -a $src/wwwroot/cgi-bin/lang $fs/usr/share/awstats
30 cp -a $src/wwwroot/cgi-bin/lib $fs/usr/share/awstats
31 cp -a $src/wwwroot/cgi-bin/plugins $fs/usr/share/awstats
33 cp -a $src/wwwroot/cgi-bin/awstats.pl $fs/var/www/cgi-bin
34 cp -a $src/wwwroot/cgi-bin/awstats.model.conf $fs/etc/awstats
36 cp $stuff/* $fs/usr/share/awstats/extras
38 # Add a link using google map
39 sed -i 's|Full Whois Field"|Full Whois Field <a href=\\"http://en.utrace.de/?query=".$HostResolved."\\">?</a>"|' \
40 $fs/usr/share/awstats/plugins/hostinfo.pm
42 # Avoid alias conflicts
43 for i in classes css icon ; do
44 sed -i "s| /$i| /awstats$i|" \
45 $fs/usr/share/awstats/extras/awstats-apache.conf
46 sed -i "s|\"/$i|\"/awstats$i|" \
47 $fs/usr/share/awstats/extras/awstats-lighttpd.conf
48 done
49 sed -i -e '/\/css\//d' -e 's|DirIcons="/icon"|DirIcons="/awstatsicon"|' \
50 $fs/etc/awstats/awstats.model.conf
51 sed -i 's/classes/awstatsclasses/' \
52 $fs/usr/share/awstats/plugins/graphapplet.pm
54 chown -R root:root $fs
55 find $fs -type f -exec chmod a-x \{\} \;
56 chmod a+x \
57 $fs/usr/share/awstats/extras/update \
58 $fs/var/www/cgi-bin/awstats.pl \
59 $fs/usr/share/awstats/classes/src/Makefile.pl
60 }
62 post_install()
63 {
64 # Set lighttpd or apache config
65 if [ -f "$1/etc/apache/httpd.conf" ]; then
66 if [ ! -f "$1/etc/apache/conf.d/awstats.conf" ]; then
68 cp "$1/usr/share/awstats/extras/awstats-apache.conf" \
69 "$1/etc/apache/conf.d/awstats.conf"
70 fi
71 if [ -z "$1" ]; then
72 # Start Web server if necessary.
73 if [ -f /var/run/apache/httpd.pid ]; then
74 /etc/init.d/apache restart
75 fi
76 fi
77 fi
79 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
80 if [ ! -f "$1/etc/lighttpd/awstats.conf" ]; then
81 cp "$1/usr/share/awstats/extras/awstats-lighttpd.conf" \
82 "$1/etc/lighttpd/awstats.conf"
83 fi
84 # Start Web server if necessary.
85 if [ -f /var/run/lighttpd.pid ]; then
86 /etc/init.d/lighttpd restart
87 fi
88 fi
89 [ "$quiet" ] || cat <<EOT
91 You should add in your crontab something like;
93 0 0 * * * /usr/share/awstats/extras/update
94 EOT
95 }
97 post_remove()
98 {
99 echo "Remove orphan dirctories."
100 [ -d /usr/share/awstats ] && rm -rf /usr/share/awstats
102 # FIXME
103 echo "All database and configuratoin files will be removed"
104 echo -n "Please confirm removing (y/N) : "; read answer
106 case $answer in
107 y|Y)
108 rm -rf /var/lib/awstats
109 rm -rf /etc/awstats
110 ;;
111 *)
112 ;;
113 esac
114 }