SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "awstats"

# SliTaz package receipt.

PACKAGE="awstats"
VERSION="7.0"
CATEGORY="network"
SHORT_DESC="Log file analyzer"
MAINTAINER="erjo@slitaz.org"
DEPENDS="perl"
SUGGESTED="perl-net-xwhois"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://awstats.sourceforge.net/"
WGET_URL="http://prdownloads.sourceforge.net/awstats/$TARBALL"
TAGS="log analyze web mail ftp"

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/awstats/extras \
        $fs/var/www/cgi-bin \
        $fs/var/lib/awstats \
        $fs/etc/awstats \
        
    cp -a $src/wwwroot/classes $fs/usr/share/awstats
    cp -a $src/wwwroot/css $fs/usr/share/awstats
    cp -a $src/wwwroot/icon $fs/usr/share/awstats
    cp -a $src/wwwroot/js $fs/usr/share/awstats
    cp -a $src/wwwroot/cgi-bin/lang $fs/usr/share/awstats
    cp -a $src/wwwroot/cgi-bin/lib $fs/usr/share/awstats
    cp -a $src/wwwroot/cgi-bin/plugins $fs/usr/share/awstats
    
    cp -a $src/wwwroot/cgi-bin/awstats.pl  $fs/var/www/cgi-bin
    cp -a $src/wwwroot/cgi-bin/awstats.model.conf  $fs/etc/awstats
    
    cp $stuff/* $fs/usr/share/awstats/extras

    # Add a link using google map
    sed -i 's|Full Whois Field"|Full Whois Field <a href=\\"http://en.utrace.de/?query=".$HostResolved."\\">?</a>"|' \
        $fs/usr/share/awstats/plugins/hostinfo.pm

    # Avoid alias conflits
    for i in classes css icon ; do
        sed -i "s| /$i| /awstats$i|" \
            $fs/usr/share/awstats/extras/awstats-apache.conf
        sed -i "s|\"/$i|\"/awstats$i|" \
            $fs/usr/share/awstats/extras/awstats-lighttpd.conf
    done
    sed -i -e '/\/css\//d' -e 's|DirIcons="/icon"|DirIcons="/awstatsicon"|' \
        $fs/etc/awstats/awstats.model.conf
    sed -i 's/classes/awstatsclasses/' \
        $fs/usr/share/awstats/plugins/graphapplet.pm
}

post_install()
{
    echo "Processing post-install commands..."
    # Set lighttpd or apache config
    if [ -f $1/etc/apache/httpd.conf ]; then
        if [ ! -f $1/etc/apache/conf.d/awstats.conf ]; then
            
            cp $1/usr/share/awstats/extras/awstats-apache.conf \
                $1/etc/apache/conf.d/awstats.conf
        fi
        if [ -z "$1" ]; then
            # Start Web server if necessary.
            if [ -f /var/run/apache/httpd.pid ]; then
                /etc/init.d/apache restart
            fi
        fi
    fi

    if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
        if [ ! -f $1/etc/lighttpd/awstats.conf ]; then
            cp $1/usr/share/awstats/extras/awstats-lighttpd.conf \
                $1/etc/lighttpd/awstats.conf            
        fi
                    # Start Web server if necessary.
        if [ -f /var/run/lighttpd.pid ]; then
            /etc/init.d/lighttpd restart
        fi
    fi
    cat <<EOT
You should add in your crontab something like;

0 0 * * * /usr/share/awstats/extras/update
EOT
}

post_remove()
{
        echo "Remove orphan dirctories."
        [ -d /usr/share/awstats ] && rm -rf /usr/share/awstats
        
        # 
        echo "All database and configuratoin files will be removed"
        echo -n "Please confirm removing (y/N) : "; read answer
        
        case $answer in 
        y|Y)
            rm -rf /var/lib/awstats
            rm -rf /etc/awstats
            ;;
        *)
            ;;
        esac
        
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)