SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "clamav"

# SliTaz package receipt.

PACKAGE="clamav"
VERSION="0.97.3"
CATEGORY="security"
SHORT_DESC="Antivirus."
MAINTAINER="paul@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.clamav.net/"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
TAGS="antivirus"

DEPENDS="zlib gmp bzip2 slitaz-base-files ncurses libltdl"
BUILD_DEPENDS="zlib-dev gmp gmp-dev bzip2-dev ncurses-dev bash"

# Rules to configure and make the package.
compile_rules()
{
    # Have to create clamav user/group to be able to compile
    adduser -s /bin/false -H -D clamav

    cd $src
    ./configure \
        --sysconfdir=/etc/clamav \
        --with-iconv=no \
        $CONFIGURE_ARGS && make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d \
        $fs/var/log/clamav $fs/var/run/clamav
    cp -a $install/usr/bin $fs/usr
    cp -a $install/usr/sbin $fs/usr
    cp -a $install/etc $fs
    # Copy only shared lib (.so)
    cp -a $install/usr/lib/*.so* $fs/usr/lib
    cp -a $install/usr/share/clamav $fs/usr/share
    # Copy daemon from /$stuff
    cp $stuff/daemon-clamd $fs/etc/init.d/clamd
    
    # Customize config
    sed -i -e "s/^Example/#Example/" \
        -e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \
        -e "s|^#PidFile.*|PidFile /var/run/clamav/clamd.pid|" \
        -e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /var/run/clamav/clamd.ctl|" \
        $fs/etc/clamav/clamd.conf
        
}

post_install()
{
    
    local user
    local group
    
    user=clamav
    group=clamav
    
    echo "Processing post-install commands..."
    
    # Enable freshclam update
    echo -n "Enabling freshclam update..."
    cd $1/etc/clamav
    sed -i 's/^Example/#Example/' freshclam.conf 
    status

    # adduser clamav if needed
    if ! grep -q "${user}:" $1/etc/passwd; then
        echo -n "Adding user/group $user..."
        chroot $1/ addgroup -S $group
        chroot $1/ adduser -s /bin/false -S -D -H -G $group $user
        status
    fi

    # Enable daily.cvd updates (sometimes needed for new version)
    chown -R ${user}:${group} $1/usr/share/clamav
    
    # Fix perms
    chroot $1/ chown -R ${user}.${group} /var/log/clamav \
        /var/run/clamav

}

# Del user clamav when pkg is removed.
post_remove()
{
    chroot "$1/" deluser clamav    
}

3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)