From 49a08287360064b069cefb2fd14498a2e80e3d07 Mon Sep 17 00:00:00 2001 From: T3slider Date: Wed, 20 May 2015 20:27:22 +0700 Subject: network/haproxy: Updated for version 1.5.12 + new maintainer. Signed-off-by: Willy Sudiarto Raharjo --- network/haproxy/README | 8 +-- network/haproxy/doinst.sh | 2 - network/haproxy/haproxy.SlackBuild | 106 ++++++++++++++++--------------------- network/haproxy/haproxy.info | 12 ++--- network/haproxy/rc.haproxy | 105 +++++++++++++++++++++++++++--------- network/haproxy/slack-desc | 8 +-- 6 files changed, 137 insertions(+), 104 deletions(-) (limited to 'network') diff --git a/network/haproxy/README b/network/haproxy/README index fd8942d3f6602..dc8ef4672852e 100644 --- a/network/haproxy/README +++ b/network/haproxy/README @@ -1,9 +1,3 @@ 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. Otherwise, please modify this SlackBuild -to suit your situation. +applications. It is particularly suited for very high traffic web sites. diff --git a/network/haproxy/doinst.sh b/network/haproxy/doinst.sh index a69f0862583d1..0b42c374681d7 100644 --- a/network/haproxy/doinst.sh +++ b/network/haproxy/doinst.sh @@ -24,5 +24,3 @@ preserve_perms() { preserve_perms etc/rc.d/rc.haproxy.new config etc/haproxy/haproxy.cfg.new - - diff --git a/network/haproxy/haproxy.SlackBuild b/network/haproxy/haproxy.SlackBuild index aa8ec9a31e30e..8eb7b61f636ba 100644 --- a/network/haproxy/haproxy.SlackBuild +++ b/network/haproxy/haproxy.SlackBuild @@ -1,8 +1,8 @@ #!/bin/sh -# + # Slackware build script for haproxy -# -# Copyright 2008 Cherife Li + +# Copyright 2015 T3slider # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -11,24 +11,19 @@ # 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: -# + By default, this SlackBuild supposes that the kernel supports epoll -# if the kernel release is 2.4.x. Otherwise, please modify this SlackBuild -# to suit your situation. +# 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. PRGNAM=haproxy -VERSION=1.3.15.7 +VERSION=${VERSION:-1.5.12} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -45,18 +40,6 @@ 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" LIBDIRSUFFIX="" @@ -71,50 +54,55 @@ else LIBDIRSUFFIX="" fi +# This should work with Slackware-provided kernels, but you may wish to +# use 'generic' instead +TARGET=${TARGET:-linux2628} + 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 +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION chown -R root:root . find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -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 {} \; + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -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 + TARGET=$TARGET \ + CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + USE_PCRE=1 \ + USE_OPENSSL=1 \ + USE_ZLIB=1 \ + EXTRA="" +make install-man \ + PREFIX=/usr \ + MANDIR=/usr/man \ + DESTDIR=$PKG +# A Makefile bug builds/installs a systemd wrapper during the +# install/install-bin step even with EXTRA=""... +install -D -m 0755 haproxy $PKG/usr/sbin/haproxy -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a CHANGELOG CONTRIB LICENSE README \ - ROADMAP SUBVERS TODO VERDATE VERSION doc/* \ - $PKG/usr/doc/$PRGNAM-$VERSION -cat $CWD/haproxy.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/haproxy.SlackBuild - -mv $PKG/usr/share/man $PKG/usr/ -rm -rf $PKG/usr/{share,/doc/haproxy} +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done -find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +install -D -m 0644 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM.new +install -D -m 0644 examples/$PRGNAM.cfg $PKG/etc/haproxy/$PRGNAM.cfg.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a CHANGELOG LICENSE README ROADMAP SUBVERS VERDATE VERSION doc examples \ + $PKG/usr/doc/$PRGNAM-$VERSION +mv $PKG/usr/doc/$PRGNAM-$VERSION/examples/errorfiles $PKG/etc/haproxy/errors +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc diff --git a/network/haproxy/haproxy.info b/network/haproxy/haproxy.info index f1614010a8311..535d0be24a00a 100644 --- a/network/haproxy/haproxy.info +++ b/network/haproxy/haproxy.info @@ -1,10 +1,10 @@ PRGNAM="haproxy" -VERSION="1.3.15.7" -HOMEPAGE="http://haproxy.1wt.eu/" -DOWNLOAD="http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.7.tar.gz" -MD5SUM="6c1978071139c5cc27563232c2a488da" +VERSION="1.5.12" +HOMEPAGE="http://www.haproxy.org/" +DOWNLOAD="http://www.haproxy.org/download/1.5/src/haproxy-1.5.12.tar.gz" +MD5SUM="4b94b257f16d88c315716b062b22e48a" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Cherife Li" -EMAIL="cherife-#-dotimes.com" +MAINTAINER="T3slider" +EMAIL="t3slider@gmail.com" diff --git a/network/haproxy/rc.haproxy b/network/haproxy/rc.haproxy index 5663cc37a14e2..a95a407133931 100644 --- a/network/haproxy/rc.haproxy +++ b/network/haproxy/rc.haproxy @@ -1,31 +1,84 @@ #!/bin/sh -# -# HAProxy daemon control script. -# Written for Slackware Linux by Cherife Li . -BIN=/usr/sbin/haproxy -CONF=/etc/haproxy/haproxy.cfg -PID=/var/run/haproxy.pid +HAPROXY=/usr/sbin/haproxy +CONFIG=/etc/haproxy/haproxy.cfg +PIDFILE=/var/run/haproxy.pid + +start() { + if [ -r $PIDFILE ]; then + echo 'HAProxy is already running!' + return + fi + $HAPROXY -f $CONFIG -D -p $PIDFILE +} + +stop() { + if [ ! -r $PIDFILE ]; then + echo 'HAProxy is not running!' + return + fi + echo "Soft-stopping HAProxy..." + kill -USR1 `cat $PIDFILE` + # Even with the right permissions the PID file will not be removed... + rm -f $PIDFILE +} + +force_stop() { + if [ ! -r $PIDFILE ]; then + echo 'HAProxy is not running!' + return + fi + echo "Hard-stopping HAProxy..." + kill `cat $PIDFILE` + # Even with the right permissions the PID file will not be removed... + rm -f $PIDFILE +} + +status() { + if [ ! -r $PIDFILE ]; then + echo "HAProxy is not running." + return + fi + PID=`cat $PIDFILE` + if [ -z "$PID" ]; then + echo 'PID file is empty! HAProxy does not appear to be running, but there is a stale PID file.' + elif kill -0 $PID; then + echo "HAProxy is running." + else + echo "HAProxy is not running, but there is a stale PID file." + fi +} + +checkconfig() { + $HAPROXY -c -q -V -f $CONFIG +} case "$1" in - check) - echo "Checking HAProxy configuration file..." - $BIN -f $CONF -cV - ;; - start) - echo "Starting HAProxy..." - $BIN -f $CONF -D -p $PID - ;; - stop) - echo "Shutting down HAProxy..." - kill -TERM `cat $PID` - rm -f $PID &> /dev/null - ;; - restart) - stop - sleep 2 - start - ;; - *) - echo "usage `basename $0` {check|start|stop|restart}" + 'start') + start + ;; + 'stop') + stop + ;; + 'force_stop') + force_stop + ;; + 'restart') + stop + start + ;; + 'force_restart') + force_stop + start + ;; + 'status') + status + ;; + 'checkconfig') + checkconfig + ;; + *) + echo "Usage: $0 {start|stop|force_stop|restart|force_restart|status|checkconfig}" + exit 1 + ;; esac diff --git a/network/haproxy/slack-desc b/network/haproxy/slack-desc index 8fb6801e04a64..773ba0f4728af 100644 --- a/network/haproxy/slack-desc +++ b/network/haproxy/slack-desc @@ -6,14 +6,14 @@ # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| -haproxy: haproxy (a free, very fast and reliable proxy) +haproxy: haproxy (a high performance TCP/HTTP load balancer) 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: applications. It is particularly suited for very high traffic web +haproxy: sites. haproxy: +haproxy: http://www.haproxy.org/ haproxy: haproxy: -haproxy: Homepage: http://haproxy.1wt.eu/ haproxy: -- cgit v1.2.3