wok annotate awstats/receipt @ rev 21777

linld: fix strdup (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 11 14:43:21 2019 +0200 (2019-07-11)
parents 9e2e108fff96
children 7aa14b7a600c
rev   line source
erjo@2649 1 # SliTaz package receipt.
erjo@2649 2
erjo@2649 3 PACKAGE="awstats"
Hans-G?nter@20732 4 VERSION="7.7"
erjo@2649 5 CATEGORY="network"
Hans-G?nter@20732 6 TAGS="log analysis web mail ftp"
erjo@2649 7 SHORT_DESC="Log file analyzer"
erjo@2649 8 MAINTAINER="erjo@slitaz.org"
pascal@15201 9 LICENSE="GPL"
al@14789 10 WEB_SITE="http://awstats.sourceforge.net/"
Hans-G?nter@20732 11
al@14789 12 TARBALL="$PACKAGE-$VERSION.tar.gz"
Hans-G?nter@20732 13 WGET_URL="https://downloads.sourceforge.net/project/$PACKAGE/AWStats/$VERSION/$TARBALL"
al@14789 14
erjo@2649 15 DEPENDS="perl"
pascal@19441 16 SUGGESTED="perl-net-xwhois perl-geo-ipfree"
erjo@2649 17
erjo@2649 18 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@2649 19 genpkg_rules()
erjo@2649 20 {
erjo@2649 21 mkdir -p $fs/usr/share/awstats/extras \
erjo@2649 22 $fs/var/www/cgi-bin \
erjo@2649 23 $fs/var/lib/awstats \
erjo@2649 24 $fs/etc/awstats \
al@14789 25
erjo@2649 26 cp -a $src/wwwroot/classes $fs/usr/share/awstats
erjo@2649 27 cp -a $src/wwwroot/css $fs/usr/share/awstats
erjo@2649 28 cp -a $src/wwwroot/icon $fs/usr/share/awstats
erjo@2649 29 cp -a $src/wwwroot/js $fs/usr/share/awstats
erjo@2649 30 cp -a $src/wwwroot/cgi-bin/lang $fs/usr/share/awstats
erjo@2649 31 cp -a $src/wwwroot/cgi-bin/lib $fs/usr/share/awstats
erjo@2649 32 cp -a $src/wwwroot/cgi-bin/plugins $fs/usr/share/awstats
al@14789 33
erjo@2649 34 cp -a $src/wwwroot/cgi-bin/awstats.pl $fs/var/www/cgi-bin
erjo@2649 35 cp -a $src/wwwroot/cgi-bin/awstats.model.conf $fs/etc/awstats
al@14789 36
pankso@9697 37 cp $stuff/* $fs/usr/share/awstats/extras
pascal@5205 38
pascal@5205 39 # Add a link using google map
pascal@5205 40 sed -i 's|Full Whois Field"|Full Whois Field <a href=\\"http://en.utrace.de/?query=".$HostResolved."\\">?</a>"|' \
pascal@5205 41 $fs/usr/share/awstats/plugins/hostinfo.pm
pascal@5959 42
al@14789 43 # Avoid alias conflicts
pascal@5959 44 for i in classes css icon ; do
pascal@5959 45 sed -i "s| /$i| /awstats$i|" \
pascal@5959 46 $fs/usr/share/awstats/extras/awstats-apache.conf
pascal@5959 47 sed -i "s|\"/$i|\"/awstats$i|" \
pascal@5959 48 $fs/usr/share/awstats/extras/awstats-lighttpd.conf
pascal@5959 49 done
pascal@5959 50 sed -i -e '/\/css\//d' -e 's|DirIcons="/icon"|DirIcons="/awstatsicon"|' \
pascal@5959 51 $fs/etc/awstats/awstats.model.conf
pascal@5959 52 sed -i 's/classes/awstatsclasses/' \
pascal@5959 53 $fs/usr/share/awstats/plugins/graphapplet.pm
al@14789 54
al@14789 55 chown -R root:root $fs
al@14789 56 find $fs -type f -exec chmod a-x \{\} \;
al@14789 57 chmod a+x \
al@14789 58 $fs/usr/share/awstats/extras/update \
al@14789 59 $fs/var/www/cgi-bin/awstats.pl \
al@14789 60 $fs/usr/share/awstats/classes/src/Makefile.pl
erjo@2649 61 }
erjo@2649 62
erjo@2649 63 post_install()
erjo@2649 64 {
erjo@2649 65 # Set lighttpd or apache config
pascal@18730 66 if [ -f "$1/etc/apache/httpd.conf" ]; then
pascal@18730 67 if [ ! -f "$1/etc/apache/conf.d/awstats.conf" ]; then
erjo@2649 68
pascal@18730 69 cp "$1/usr/share/awstats/extras/awstats-apache.conf" \
pascal@18730 70 "$1/etc/apache/conf.d/awstats.conf"
erjo@2649 71 fi
erjo@2649 72 if [ -z "$1" ]; then
erjo@2649 73 # Start Web server if necessary.
erjo@2649 74 if [ -f /var/run/apache/httpd.pid ]; then
erjo@2649 75 /etc/init.d/apache restart
erjo@2649 76 fi
erjo@2649 77 fi
erjo@2649 78 fi
erjo@2649 79
pascal@18730 80 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
pascal@18730 81 if [ ! -f "$1/etc/lighttpd/awstats.conf" ]; then
pascal@18730 82 cp "$1/usr/share/awstats/extras/awstats-lighttpd.conf" \
pascal@18730 83 "$1/etc/lighttpd/awstats.conf"
erjo@2649 84 fi
erjo@2649 85 # Start Web server if necessary.
erjo@2649 86 if [ -f /var/run/lighttpd.pid ]; then
erjo@2649 87 /etc/init.d/lighttpd restart
erjo@2649 88 fi
erjo@2649 89 fi
pascal@18707 90 [ "$quiet" ] || cat <<EOT
al@18667 91
pascal@5959 92 You should add in your crontab something like;
pascal@5959 93
pascal@5959 94 0 0 * * * /usr/share/awstats/extras/update
pascal@5959 95 EOT
erjo@2649 96 }
erjo@2649 97
erjo@2649 98 post_remove()
erjo@2649 99 {
erjo@2649 100 echo "Remove orphan dirctories."
erjo@2649 101 [ -d /usr/share/awstats ] && rm -rf /usr/share/awstats
al@14789 102
al@18667 103 # FIXME
erjo@2649 104 echo "All database and configuratoin files will be removed"
erjo@2649 105 echo -n "Please confirm removing (y/N) : "; read answer
al@14789 106
al@18667 107 case $answer in
al@14789 108 y|Y)
al@14789 109 rm -rf /var/lib/awstats
al@14789 110 rm -rf /etc/awstats
al@14789 111 ;;
al@14789 112 *)
al@14789 113 ;;
erjo@2649 114 esac
erjo@2649 115 }