SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "webalizer"

# SliTaz package receipt.

PACKAGE="webalizer"
VERSION="2.23.08"
CATEGORY="network"
TAGS="logs"
SHORT_DESC="Web server log file analysis program."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://www.patrickfrei.ch/webalizer/"

TARBALL="$PACKAGE-${VERSION%.*}-${VERSION##*.}-src.tar.bz2"
WGET_URL="http://download.nust.na/pub/$PACKAGE/$TARBALL"

DEPENDS="apache db libgd zlib"
BUILD_DEPENDS="db-dev libgd-dev zlib-dev"

# What is the latest version available today?
current_version()
{
    wget -O - $WEB_SITE 2>/dev/null | \
    sed "/latest/d;/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-||;s|-src.*||;s|-|.|;q"
}

# Rules to configure and make the package.
compile_rules()
{
    export LDFLAGS="$LDFLAGS -lpthread"
    sed -i 's/define _LARGEFILE64_SOURCE = 1/define _LARGEFILE64_SOURCE/' \
        webalizer.c

    ./configure        \
        --sysconfdir=/etc &&
    make &&
    make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr
    mkdir -p $fs/etc
    mkdir -p $fs/var/www/webalizer
    chown 80 $fs/var/www/webalizer
    mkdir -p $fs/etc/initcron.d

    cp -a $install/etc/webalizer.conf.sample    $fs/etc/webalizer.conf
    cp -a $install/usr/bin                $fs/usr

    cat > $fs/etc/initcron.d/webalizer << EOT

30 0 * * * /usr/bin/webalizer -o /var/www/webalizer /var/log/apache/access_log
EOT

    chmod +x $fs/etc/initcron.d/webalizer
}

# Pre and post install commands for Tazpkg.
pre_remove()
{
    sed -i '/webalizer/d' "$1/etc/init.d/local.sh"
    if [ -z "$1" ]
      then
        crontab -l 2> /dev/null | grep -q webalizer || crontab - << EOT
$(crontab -l 2> /dev/null | grep -v webalizer)
EOT
    fi
}

post_install()
{
    grep -q webalizer "$1/etc/init.d/local.sh" || \
    cat >> "$1/etc/init.d/local.sh" <<EOT
[ -f /var/www/webalizer/index.html ] || /usr/bin/webalizer -o /var/www/webalizer /var/log/apache/access_log
EOT

    if [ -z "$1" ]
      then
        webalizer -o /var/www/webalizer /var/log/apache/access_log 
        crontab -l 2> /dev/null | grep -q webalizer || crontab - << EOT
$(crontab -l 2> /dev/null)
$(cat /etc/initcron.d/webalizer)
EOT
      chmod -x /etc/initcron.d/webalizer
    fi
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)