SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg

Receipt for package "haproxy"

# SliTaz package receipt.

PACKAGE="haproxy"
VERSION="2.0.31"
CATEGORY="network"
SHORT_DESC="Reliable, High Performance TCP/HTTP Load Balancer."
MAINTAINER="shann@slitaz.org"
WEB_SITE="https://www.haproxy.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$WEB_SITE/download/${VERSION%.*}/src/$TARBALL"
HOST_ARCH="x86_64"

DEPENDS="gcc-lib-base pcre openssl lua5.4"
BUILD_DEPENDS="pcre-dev openssl-dev lua5.4-dev"

CONFIG_FILES="/etc/haproxy/haproxy.cfg"

# Rules to configure and make the package.
compile_rules()
{
    cd $src
    make CPU=generic TARGET=linux-glibc USE_PCRE=1 \
    USE_GETADDRINFO=1 USE_LUA=1 USE_OPENSSL=1 PREFIX=/usr
    make PREFIX=/usr DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p \
        $fs/etc/init.d \
        $fs/usr/share/haproxy \
        $fs/etc/haproxy/modules \
        $fs/usr/share/haproxy/.well-known/acme-challenge
 
    cp -a $_pkg/usr/sbin $fs/usr
    cp -a $stuff/haproxy.cfg $fs/etc/haproxy
    cp -a $stuff/acme-webroot.lua $fs/etc/haproxy/modules

    cp $stuff/daemon $fs/etc/init.d/haproxy
}

# Pre and post install command for Tazpkg.
post_install()
{
    local user
    local group

    user=haproxy
    group=haproxy

    if ! grep -q ${user} "$1/etc/passwd"; then
        echo
        echo -n "Adding user HAProxy..."
        chroot "$1/" /usr/sbin/addgroup -g 101 -S ${group}
        chroot "$1/" /usr/sbin/adduser -s /bin/false -h /dev/null \
                -g "HAProxy Daemon user" -u 101 -H -D -S -G ${group} ${user}
        status
    fi
    chroot "$1/" /bin/chown -R ${user}.${group} /usr/share/haproxy

    if ! grep -q ^HAPROXY_OPTIONS $root/etc/daemons.conf; then
        echo '# HAProxy daemon options.' >> $root/etc/daemons.conf   
        echo 'HAPROXY_OPTIONS="-q -f /etc/haproxy/haproxy.cfg"' >> $root/etc/daemons.conf
        echo '' >> $root/etc/daemons.conf
    fi
}
6107 packages and 261132 files in current database (Mon Jul 7 00:01:25 2025)