summaryrefslogtreecommitdiffstats
path: root/unstable
diff options
context:
space:
mode:
authorMichael Mason <ms13sp@gmail.com>2009-04-07 21:08:30 +0000
committerMichael Mason <ms13sp@gmail.com>2009-04-07 21:08:30 +0000
commitd5816d16609298432d347295442aa0524af64010 (patch)
tree235644e82d5bfc8e698dd47fc1d558be0d7718cf /unstable
parente49ac0726d9f8c70ea299b5291471ca009db4f75 (diff)
downloadaports-d5816d16609298432d347295442aa0524af64010.tar.bz2
aports-d5816d16609298432d347295442aa0524af64010.tar.xz
unstable/ucarp Initial commit
Diffstat (limited to 'unstable')
-rw-r--r--unstable/ucarp/APKBUILD33
-rw-r--r--unstable/ucarp/ucarp.confd10
-rw-r--r--unstable/ucarp/ucarp.initd62
3 files changed, 105 insertions, 0 deletions
diff --git a/unstable/ucarp/APKBUILD b/unstable/ucarp/APKBUILD
new file mode 100644
index 00000000..fe3afce0
--- /dev/null
+++ b/unstable/ucarp/APKBUILD
@@ -0,0 +1,33 @@
+# Contributor:
+# Maintainer:
+pkgname=ucarp
+pkgver=1.5
+pkgrel=0
+pkgdesc="Share common IP and do fail over"
+url="http://www.ucarp.org"
+license="GPL"
+depends="uclibc libpcap"
+makedepends="libpcap-dev"
+install=
+subpackages=""
+source="http://download.pureftpd.org/pub/ucarp/$pkgname-$pkgver.tar.gz
+ ucarp.initd
+ ucarp.confd"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make DESTDIR="$pkgdir" install
+
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+md5sums="ba585233e73f0dbce80427d04f431048 ucarp-1.5.tar.gz
+fae5ca64ed20a9346b00e9c9411a43c8 ucarp.initd
+ffdbc07da100b4882cc5da9121c0c842 ucarp.confd"
diff --git a/unstable/ucarp/ucarp.confd b/unstable/ucarp/ucarp.confd
new file mode 100644
index 00000000..86b501c3
--- /dev/null
+++ b/unstable/ucarp/ucarp.confd
@@ -0,0 +1,10 @@
+# Things you can set here
+# REALIP - if not set, will be first addr on iface
+# VHID - Virtual Server ID
+# VIP - The Virtual IP
+# PASSWORD - The password for the carp announcements
+
+REALIP=
+VHID=2
+VIP=127.0.0.1
+PASSWORD=SecretPassword
diff --git a/unstable/ucarp/ucarp.initd b/unstable/ucarp/ucarp.initd
new file mode 100644
index 00000000..b924f3b5
--- /dev/null
+++ b/unstable/ucarp/ucarp.initd
@@ -0,0 +1,62 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+
+# A simple script to start and stop a ucarp instance
+DAEMON=/usr/sbin/ucarp
+
+IFACE="${SVCNAME#*.}"
+if [ -n "$IFACE" ] && [ "${SVCNAME}" != "ucarp" ]; then
+ UP="/etc/ucarp/vip-up-$IFACE.sh"
+ DOWN="/etc/ucarp/vip-down-$IFACE.sh"
+ . /etc/ucarp/$IFACE.conf
+else
+ UP="/etc/ucarp/vip-up.sh"
+ DOWN="/etc/ucarp/vip-down.sh"
+fi
+
+
+# Get the primary ip address for a given interface
+get_first_ip() {
+ local foo=$( ip addr show $1 )
+ [ $? != 0 ] && foo=""
+ echo $( echo "$foo" | grep "inet " | head -n1 | \
+ sed "s+^.*inet ++g; s+/.*$++g" )
+}
+
+if [ -z "$REALIP" ]; then
+ REALIP=$( get_first_ip $IFACE )
+fi
+
+start () {
+ ebegin "Starting ucarp $IFACE"
+ start-stop-daemon --start --exec $DAEMON \
+ --background -m -p /var/run/ucarp-$IFACE.pid -- \
+ -i $IFACE -s $REALIP -v $VHID -p $PASSWORD -a $VIP \
+ -u $UP -d $DOWN -z
+ eend $?
+}
+
+status () {
+ ebegin "ucarp $IFACE is ..."
+ PIDS=$( pidof $( basename $DAEMON ))
+ PID=$( cat /var/run/ucarp-$IFACE.pid 2>/dev/null )
+ [ -n "$PID" ] && OK=$( echo "$PIDS" | grep "$PID" )
+ if [ -n "$OK" ]; then
+ echo "running"
+ exit 0
+ else
+ echo "not running"
+ exit 1
+ fi
+}
+
+stop () {
+ ebegin "Shuting down ucarp $IFACE"
+ start-stop-daemon --stop --exec $DAEMON \
+ -p /var/run/ucarp-$IFACE.pid
+ [ $? -eq 0 ] && rm /var/run/ucarp-$IFACE.pid
+ eend $?
+}