SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "squid"

# SliTaz package receipt.

PACKAGE="squid"
VERSION="3.1.19"
CATEGORY="network"
SHORT_DESC="Web/ftp proxy."
MAINTAINER="pascal.bellard@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="http://www.squid-cache.org/"
WGET_URL="${WEB_SITE}Versions/v3/3.1/$TARBALL"
CONFIG_FILES="/etc/squid"
DEPENDS="libsasl libldap libssl libltdl"
BUILD_DEPENDS="perl openssl-dev openldap-dev cyrus-sasl-dev"
SUGGESTED="iptables"

# Rules to configure and make the package.
compile_rules()
{
    cd $src
    ./configure \
        --prefix=/usr \
        --sysconfdir=/etc/squid \
        --datadir=/usr/share/squid \
        --libexecdir=/usr/lib/squid \
        --localstatedir=/var \
        --with-logdir=/var/log/squid \
        --disable-poll \
        --disable-snmp \
        --disable-icmp \
        --enable-http-violations \
        --disable-ident-lookups \
        --enable-storeio="aufs,diskd,ufs" \
        --enable-ssl \
        --enable-underscores \
        --enable-ntlm-fail-open \
        --enable-removal-policies="heap,lru" \
        --enable-delay-pools \
        --enable-linux-netfilter \
        --enable-basic-auth-helpers="NCSA,SMB,MSNT,LDAP" \
        --enable-ntlm-auth-helpers="smb_lm,no_check,fakeauth" \
        --enable-useragent-log \
        --enable-referer-log \
        --enable-icap-client \
        --with-pthreads ac_cv_header_linux_netfilter_ipv4_h="yes" \
        $CONFIGURE_ARGS &&
    make $MAKEFLAGS && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/squid/errors $fs/var/cache/squid $fs/var/log/squid \
        $fs/usr/lib/squid $fs/etc/squid/conf.d
    
    touch $fs/var/log/squid/cache.log
    
    cp -a $install/etc $fs
    rm -rf $fs/etc/squid/*.default
    cp -a $stuff/etc $fs
    
    cp -a $install/var $fs
    cp -a $install/usr/bin $fs/usr
    cp -a $install/usr/sbin $fs/usr
    cp -a $install/usr/lib/squid/*kd $fs/usr/lib/squid
    cp -a $install/usr/lib/squid/*.cgi $fs/usr/lib/squid
    
    cp -a $install/usr/share/squid/mib.txt $fs/usr/share/squid
    cp -a $install/usr/share/squid/icons $fs/usr/share/squid
    cp -a $install/usr/share/squid/errors/templates $fs/usr/share/squid/errors
    cp -a $install/usr/share/squid/errors/en* $fs/usr/share/squid/errors
    cp -a $install/usr/share/squid/errors/fr* $fs/usr/share/squid/errors
    
    sed -i \
        -e 's/TAG: visible_hostname/TAG: visible_hostname\nvisible_hostname slitaz/' \
        -e 's|^#cache_dir ufs /var/cache 100|cache_dir ufs /var/cache/squid 256|' \
        -e 's|^#pid_filename /var/logs|pid_filename /var/run/squid.pid|' \
        -e "s|^coredump_dir.*|coredump_dir /var/cache/squid|" \
        -e 's|^# error_directory|error_directory /usr/share/squid/errors/French|' \
        -e 's|^# error_directory|error_directory /usr/share/squid/errors/French|' \
        $fs/etc/squid/squid.conf
        
    cat <<EOF>>$fs/etc/squid/squid.conf
    
cache_effective_user squid
cache_effective_group squid 

access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log

include /etc/squid/conf.d/*.conf
EOF
}

# Pre and post install commands for Tazpkg.
post_install()
{
    local root
    local user
    local group
    
    user=squid
    group=squid
    
    if ! grep -q $user $1/etc/passwd; then
        echo -n "Adding user/group $user..."
        chroot $1/ addgroup -S $group
        chroot $1/ adduser -S -D -H -G $group $user
        status
    fi
    

    # Set perms for files and directories
    chroot $1/ chown -R ${user}.${group} /var/log/squid \
        /var/cache/squid 

    cat <<EOF
----
To start $PACKAGE server you can run :

    /etc/init.d/$PACKAGE start

Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
----
EOF
}


post_remove()
{
    echo "Removing stalled files..."
    test -d /var/cache/squid && rm -rf /var/cache/squid
    test -d /var/log/squid && rm -rf /var/log/squid
    test -d /usr/share/squid && rm -rf /usr/share/squid
    
    echo "Removing user/group squid"
    deluser squid
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)