From 57ffdc3d18412f405daec78eeefca32a12fb2e63 Mon Sep 17 00:00:00 2001 From: Cherife Li Date: Tue, 11 May 2010 22:54:48 +0200 Subject: network/haproxy: Added to 12.1 repository --- network/haproxy/README | 10 ++++ network/haproxy/doinst.sh | 14 +++++ network/haproxy/haproxy.SlackBuild | 116 +++++++++++++++++++++++++++++++++++++ network/haproxy/haproxy.info | 8 +++ network/haproxy/rc.haproxy | 35 +++++++++++ network/haproxy/slack-desc | 19 ++++++ 6 files changed, 202 insertions(+) create mode 100644 network/haproxy/README create mode 100644 network/haproxy/doinst.sh create mode 100644 network/haproxy/haproxy.SlackBuild create mode 100644 network/haproxy/haproxy.info create mode 100644 network/haproxy/rc.haproxy create mode 100644 network/haproxy/slack-desc (limited to 'network/haproxy') diff --git a/network/haproxy/README b/network/haproxy/README new file mode 100644 index 0000000000..be33fe7b4b --- /dev/null +++ b/network/haproxy/README @@ -0,0 +1,10 @@ +HAProxy is a free, very fast and reliable solution offering high +availability, load balancing, and proxying for TCP and HTTP-based +applications. It is particularly suited for web sites crawling under +very high loads while needing persistence or Layer7 processing. + +Note: +By default, this SlackBuild supposes that the kernel supports epoll if +the kernel release is 2.4.x. +This is a reasonable choice for running HAProxy, isn't it? +Otherwise, please remember to modify this SlackBuild. diff --git a/network/haproxy/doinst.sh b/network/haproxy/doinst.sh new file mode 100644 index 0000000000..3560e24e37 --- /dev/null +++ b/network/haproxy/doinst.sh @@ -0,0 +1,14 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/rc.d/rc.haproxy.new diff --git a/network/haproxy/haproxy.SlackBuild b/network/haproxy/haproxy.SlackBuild new file mode 100644 index 0000000000..7870f6b498 --- /dev/null +++ b/network/haproxy/haproxy.SlackBuild @@ -0,0 +1,116 @@ +#!/bin/sh +# +# Slackware build script for haproxy +# +# Copyright 2008 Cherife Li +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Notes: +# + Don't forget to check the VERSION number. +# + You may want to customize the configure options. +# + By default, this SlackBuild supposes that the kernel supports epoll +# if the kernel release is 2.4.x. +# This is a reasonable choice for running HAProxy, isn't it? +# Otherwise, please remember to modify this SlackBuild. + +PRGNAM=haproxy +VERSION=1.3.15.2 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +CPU=$(uname -m) +KERNEL=$(uname -r|cut -c3) +if [ "$KERNEL" = "4" ]; then + TARGET="linux24e" +elif [ "$KERNEL" = "6" ]; then + TARGET="linux26" +elif [ "$KERNEL" = "2" ]; then + TARGET="linux22" +else + TARGET="generic" +fi + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || exit 1 +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +make \ + TARGET=$TARGET \ + CPU=$CPU \ + CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + USE_PCRE=1 \ + USE_REGPARM=1 \ + USE_STATIC_PCRE=1 \ + || exit 1 +make install PREFIX=/usr DESTDIR=$PKG || exit 1 + +mkdir -p $PKG/etc/{rc.d,haproxy} +cat $CWD/rc.haproxy > $PKG/etc/rc.d/rc.haproxy.new +cat ./examples/haproxy.cfg > $PKG/etc/haproxy/haproxy.cfg.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a CHANGELOG CONTRIB LICENSE README ROADMAP SUBVERS VERSION doc/* $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/haproxy.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/haproxy.SlackBuild + +# Compress man pages +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +) + +# Strip everything for good measure: +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +# Build the package: +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/network/haproxy/haproxy.info b/network/haproxy/haproxy.info new file mode 100644 index 0000000000..f5d187180d --- /dev/null +++ b/network/haproxy/haproxy.info @@ -0,0 +1,8 @@ +PRGNAM="haproxy" +VERSION="1.3.15.2" +HOMEPAGE="http://haproxy.1wt.eu/" +DOWNLOAD="http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.2.tar.gz" +MD5SUM="a64d7f5a7464e769f8676802be8e8f36" +MAINTAINER="Cherife Li" +EMAIL="cherife@dotimes.com" +APPROVED="David Somero" diff --git a/network/haproxy/rc.haproxy b/network/haproxy/rc.haproxy new file mode 100644 index 0000000000..6f224d7f76 --- /dev/null +++ b/network/haproxy/rc.haproxy @@ -0,0 +1,35 @@ +#!/bin/sh +# +# HAProxy daemon control script. +# +# This is an init script for the haproxy daemon. +# To use haproxy, you must first set up the config file(s). +# +# Written for Slackware Linux by Cherife Li . +# + +Bin=/usr/sbin/haproxy +CfgFile=/etc/haproxy/haproxy.cfg +PIDFile=/var/run/haproxy.pid + +case "$1" in + check) + echo "Checking HAProxy configuration file..." + $Bin -f $CfgFile -cV + ;; + start) + echo "Starting HAProxy..." + $Bin -f $CfgFile -D -p $PIDFile + ;; + stop) + echo "Shutting down HAProxy..." + kill -TERM `cat $PIDFile` + rm -f $PIDFile + ;; + restart) + stop + start + ;; + *) + echo "usage $0 {check|start|stop|restart}" +esac diff --git a/network/haproxy/slack-desc b/network/haproxy/slack-desc new file mode 100644 index 0000000000..367377fb42 --- /dev/null +++ b/network/haproxy/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +haproxy: haproxy (a free, very fast and reliable proxy) +haproxy: +haproxy: HAProxy is a free, very fast and reliable solution offering high +haproxy: availability, load balancing, and proxying for TCP and HTTP-based +haproxy: applications. It is particularly suited for web sites crawling under +haproxy: very high loads while needing persistence or Layer7 processing. +haproxy: +haproxy: +haproxy: +haproxy: Homepage: http://haproxy.1wt.eu/ +haproxy: -- cgit v1.2.3