summaryrefslogtreecommitdiff
path: root/community/ucarp
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-12-06 23:14:44 +0000
committerroot <root@rshg054.dnsready.net>2011-12-06 23:14:44 +0000
commitd1d87d2ac643e3dabc251f3cec7d3b00e29b282c (patch)
tree09d9025934fe06bd25753f98cf2eab3140456cc3 /community/ucarp
parent55d1e19e71b453a0f47c599f281a2ad2644247d2 (diff)
Tue Dec 6 23:14:44 UTC 2011
Diffstat (limited to 'community/ucarp')
-rw-r--r--community/ucarp/01-fix-getopt.patch11
-rw-r--r--community/ucarp/02-fix-downscript-on-error.c12
-rw-r--r--community/ucarp/PKGBUILD50
-rw-r--r--community/ucarp/ucarp.conf3
-rw-r--r--community/ucarp/ucarp.rc34
5 files changed, 110 insertions, 0 deletions
diff --git a/community/ucarp/01-fix-getopt.patch b/community/ucarp/01-fix-getopt.patch
new file mode 100644
index 000000000..9a4b21eeb
--- /dev/null
+++ b/community/ucarp/01-fix-getopt.patch
@@ -0,0 +1,11 @@
+--- ucarp-1.5.1.orig/src/ucarp_p.h
++++ ucarp-1.5.1/src/ucarp_p.h
+@@ -1,7 +1,7 @@
+ #ifndef __CARP_P_H__
+ #define __CARP_P_H__ 1
+
+-static const char *GETOPT_OPTIONS = "i:s:v:p:Pa:hb:k:x:nu:d:r:zf:BoSM";
++static const char *GETOPT_OPTIONS = "i:s:v:p:Pa:hb:k:x:nu:d:r:zf:Bo:SM";
+
+ static struct option long_options[] = {
+ { "interface", 1, NULL, 'i' },
diff --git a/community/ucarp/02-fix-downscript-on-error.c b/community/ucarp/02-fix-downscript-on-error.c
new file mode 100644
index 000000000..08af568b4
--- /dev/null
+++ b/community/ucarp/02-fix-downscript-on-error.c
@@ -0,0 +1,12 @@
+--- ucarp-1.5.1.orig/src/carp.c
++++ ucarp-1.5.1/src/carp.c
+@@ -843,6 +843,9 @@
+ if ((pfds[0].revents & (POLLERR | POLLHUP)) != 0) {
+ logfile(LOG_ERR, _("exiting: pfds[0].revents = %d"),
+ pfds[0].revents);
++ if ((sc.sc_state != BACKUP) && (shutdown_at_exit != 0)) {
++ (void) spawn_handler(dev_desc_fd, downscript);
++ }
+ break;
+ }
+ if (gettimeofday(&now, NULL) != 0) {
diff --git a/community/ucarp/PKGBUILD b/community/ucarp/PKGBUILD
new file mode 100644
index 000000000..fa1879371
--- /dev/null
+++ b/community/ucarp/PKGBUILD
@@ -0,0 +1,50 @@
+# $Id$
+# Maintainer: Sebastien Luttringer <seblu+arch@seblu.net>
+
+pkgname=ucarp
+pkgver=1.5.2
+pkgrel=1
+pkgdesc='UCARP is a portable implementation of the CARP protocol'
+arch=('i686' 'x86_64')
+url='http://www.ucarp.org/project/ucarp'
+license=('GPL2')
+depends=('libpcap')
+optdepends=('iproute2')
+source=("http://download.pureftpd.org/pub/ucarp/ucarp-$pkgver.tar.gz"
+ 'ucarp.rc'
+ 'ucarp.conf'
+ '01-fix-getopt.patch'
+ '02-fix-downscript-on-error.c')
+md5sums=('e3caa733316a32c09e5d3817617e9145'
+ 'd941d2978c5b43154a29212115729519'
+ '35d1aabe416384e6fd8bd62312dbdb25'
+ '3f20699aaf2ef8139dcd337f1e7f06ab'
+ '09d26233c37956cf08e629554a91b8cd')
+
+build() {
+ cd $pkgname-$pkgver
+ patch -N -p1 -i ../01-fix-getopt.patch
+ patch -N -p1 -i ../02-fix-downscript-on-error.c
+
+ ./configure --prefix=/usr --mandir=/usr/share/man
+ make
+
+ # fix iproute2 path
+ sed -i "s|/sbin|/usr/sbin|g" examples/linux/vip-down.sh
+ sed -i "s|/sbin|/usr/sbin|g" examples/linux/vip-up.sh
+}
+
+package() {
+ # add initscripts
+ install -D -m 755 $pkgname.rc "${pkgdir}/etc/rc.d/$pkgname"
+ install -D -m 644 $pkgname.conf "${pkgdir}/etc/conf.d/$pkgname"
+
+ cd $pkgname-$pkgver
+ make DESTDIR="$pkgdir" install
+
+ install -D -m 755 examples/linux/vip-down.sh "$pkgdir/etc/ucarp/vip-down.sh"
+ install -D -m 755 examples/linux/vip-up.sh "$pkgdir/etc/ucarp/vip-up.sh"
+
+}
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/community/ucarp/ucarp.conf b/community/ucarp/ucarp.conf
new file mode 100644
index 000000000..3b7ae2118
--- /dev/null
+++ b/community/ucarp/ucarp.conf
@@ -0,0 +1,3 @@
+# vim:set ts=2 sw=2 ft=sh noet:
+
+DAEMON_OPTS='--daemonize --interface=eth0 --srcip=10.1.1.1 --vhid=1 --pass=mypassword --addr=10.1.1.252 --upscript=/etc/ucarp/vip-up.sh --downscript=/etc/ucarp/vip-down.sh'
diff --git a/community/ucarp/ucarp.rc b/community/ucarp/ucarp.rc
new file mode 100644
index 000000000..33f40268f
--- /dev/null
+++ b/community/ucarp/ucarp.rc
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+NAME=ucarp
+DAEMON=/usr/sbin/ucarp
+PID=$(pidof -o %PPID $DAEMON)
+
+case "$1" in
+ start)
+ stat_busy "Starting $NAME daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTS && add_daemon $NAME && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping $NAME daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon $NAME && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh noet: