SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "squidguard"

# SliTaz package receipt.

PACKAGE="squidguard"
VERSION="1.4.0"
CATEGORY="network"
SHORT_DESC="Web filter."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="https://web.archive.org/web/20220728071047/http://www.squidguard.org/"
WGET_URL="https://www.joonet.de/sources/$PACKAGE/$TARBALL"
DEPENDS="squid libdb"
BUILD_DEPENDS="db-dev"

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

# Rules to configure and make the package.
compile_rules()
{
    # Security patches 
    while read patch_file; do
        echo "Apply $patch_file"
        tar xvzf  $stuff/$patch_file || return 1
        cp -a $(basename $patch_file .tar.gz)/* src
    done <<EOT
squidGuard-1.4-patch-20091015.tar.gz
squidGuard-1.4-patch-20091019.tar.gz
squidGuard-1.4-patch-20150201.tar.gz
EOT
    # Add support for squid 3.4
    patch -p1 < $stuff/squidGuard-1.4_upgrade.patch
    patch -p1 < $stuff/squidGuard-1.4-dnsbl.patch
    
    ./configure --prefix=/usr --infodir=/usr/share/info \
    --sysconfdir=/etc --with-sg-config=/etc/squidGuard/squidGuard.conf \
    --with-sg-logdir=/var/lib/squidGuard/log \
    --with-sg-dbhome=/var/lib/squidGuard/db \
    --mandir=/usr/share/man $CONFIGURE_ARGS
    
    make
    sed -e "s|^prefix =.*|prefix = $DESTDIR/usr|" \
        -e "s|^logdir =.*|logdir = $DESTDIR/var/lib/squidGuard/log|" \
        -e "s|^configfile =.*|configfile = $DESTDIR/etc/squidGuard/squidGuard.conf|" \
        -e "s|^dbhomedir =.*|dbhomedir = $DESTDIR/var/lib/squidGuard/db|" \
        -e "s|^SQUIDUSER =.*|SQUIDUSER = nobody|" \
        < Makefile > Makefile.slitaz-install
    mkdir -p $DESTDIR/etc/squidGuard
    make -f Makefile.slitaz-install install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/etc/squid/conf.d
    
    cp -a $install/* $fs/
    cp -pa $stuff/squidguard.conf $fs/etc/squid/conf.d
    
    # Cleanup.
    rmdir $fs/usr/squidGuard
    
}

# Pre and post install commands for Tazpkg.
post_install()
{
    chown -R nobody "$1"/var/lib/squidGuard/*
    # Recharge squid config
    [ "$1" ] || { [ -x $(which squid) ] && $(which squid) -k reconfigure 2> /dev/null; }
}

post_remove()
{
    # Recharge squid config
    [ "$1" ] || { [ -x $(which squid) ] && $(which squid) -k reconfigure 2> /dev/null; }
}

check_config()
{
    su -c 'echo "http://www.example.com 192.168.0.6/- - GET" | \
        squidGuard -c /etc/squidGuard/squidGuard.conf -d' nobody
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)