Subject: [alpine-devel] [PATCH] testing/keepalived: new aport

From: Pablo Castorino <[email-masked]>
Date: Mon, 27 Dec 2010 14:51:23 +0000

---
 testing/keepalived/APKBUILD                        |   62 ++++++++++++++++++
 .../keepalived-1.1.20-ipvs_haeader_check.patch     |   68 ++++++++++++++++++++
 testing/keepalived/keepalived.confd                |    7 ++
 testing/keepalived/keepalived.initd                |   25 +++++++
 4 files changed, 162 insertions(+), 0 deletions(-)
 create mode 100644 testing/keepalived/APKBUILD
 create mode 100644 testing/keepalived/keepalived-1.1.20-ipvs_haeader_check.patch
 create mode 100644 testing/keepalived/keepalived.confd
 create mode 100755 testing/keepalived/keepalived.initd

diff --git a/testing/keepalived/APKBUILD b/testing/keepalived/APKBUILD
new file mode 100644
index 0000000..dbe3adc
--- /dev/null
+++ b/testing/keepalived/APKBUILD
@@ -0,0 +1,62 @@
+# This is an example APKBUILD file. Use this as a start to creating your own,
+# and remove these comments. 
+# NOTE: Please fill out the license field for your package! If it is unknown,
+# then please put 'unknown'.
+
+# Contributor: Pablo Castorino <[email-masked]>
+# Maintainer: Pablo Castorino <[email-masked]>
+pkgname=keepalived
+pkgver=1.1.20
+pkgrel=0
+pkgdesc="Health Checking for Linux Virtual Server & High-Availability"
+url="http://www.keepalived.org/"
+license="GPL"
+depends= 
+makedepends="openssl-dev popt-dev linux-headers"
+install=
+subpackages="$pkgname-doc"
+source="http://www.keepalived.org/software/$pkgname-$pkgver.tar.gz
+	keepalived-1.1.20-ipvs_haeader_check.patch
+	$pkgname.initd
+	$pkgname.confd
+	"
+
+# append extra dependencies to -dev subpackage
+# remove if not used.
+# depends_dev="somepackage-dev"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+	cd "$_builddir"
+	# apply patches here
+	for i in ../*.patch; do                    
+		msg "Applying $i"
+		patch -p1 -i $i || return 1
+	done
+	                                        
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr \
+		--sysconfdir=/etc \
+		--with-kernel-dir=/usr/include/linux \
+		--mandir=/usr/share/man \
+		--infodir=/usr/share/info
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make DESTDIR="$pkgdir" install
+
+	# remove the 2 lines below (and this) if there is no init.d script
+	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+md5sums="6c3065c94bb9e2187c4b5a80f6d8be31  keepalived-1.1.20.tar.gz
+78c19e15f649e353c2fba44e1f70b1e1  keepalived-1.1.20-ipvs_haeader_check.patch
+d20faa8d55b8a41b8ddb71bb00a6bead  keepalived.initd
+56ff68ad19e973826c2dbc42c892939f  keepalived.confd"
diff --git a/testing/keepalived/keepalived-1.1.20-ipvs_haeader_check.patch b/testing/keepalived/keepalived-1.1.20-ipvs_haeader_check.patch
new file mode 100644
index 0000000..d5220fe
--- /dev/null
+++ b/testing/keepalived/keepalived-1.1.20-ipvs_haeader_check.patch
@@ -0,0 +1,68 @@
+--- old/configure
++++ new/configure
+@@ -3849,8 +3889,8 @@
+ 
+ IPVS_SUPPORT="_WITHOUT_LVS_"
+ if test "$enable_lvs" != "no"; then
+-  ac_fn_c_check_header_mongrel "$LINENO" "net/ip_vs.h" "ac_cv_header_net_ip_vs_h" "$ac_includes_default"
+-if test "x$ac_cv_header_net_ip_vs_h" = x""yes; then :
++  ac_fn_c_check_header_mongrel "$LINENO" "linux/ip_vs.h" "ac_cv_header_linux_ip_vs_h" "$ac_includes_default"
++if test "x$ac_cv_header_linux_ip_vs_h" = xyes; then :
+   IPVS_SUPPORT="_WITH_LVS_"
+ else
+ 
+--- old/configure.in
++++ new/configure.in
+@@ -113,7 +113,7 @@
+ dnl ----[ Checks for LVS and VRRP support ]----
+ IPVS_SUPPORT="_WITHOUT_LVS_"
+ if test "$enable_lvs" != "no"; then
+-  AC_CHECK_HEADER([net/ip_vs.h],
++  AC_CHECK_HEADER([linux/ip_vs.h],
+     [IPVS_SUPPORT="_WITH_LVS_"],
+     [
+       IPVS_SUPPORT="_WITHOUT_LVS_"
+--- keepalived-1.1.20-orig/keepalived/include/check_data.h
++++ keepalived-1.1.20/keepalived/include/check_data.h
+@@ -33,7 +33,7 @@
+ 
+ #ifdef _WITH_LVS_
+   #define SCHED_MAX_LENGTH IP_VS_SCHEDNAME_MAXLEN
+-  #include <net/ip_vs.h>
++  #include <linux/ip_vs.h>
+ #else
+   #define SCHED_MAX_LENGTH   1
+ #endif
+--- keepalived-1.1.20-orig/keepalived/include/ipvswrapper.h
++++ keepalived-1.1.20/keepalived/include/ipvswrapper.h
+@@ -43,7 +43,7 @@
+ #elif _KRNL_2_6_
+   #include "../libipvs-2.6/libipvs.h"
+ #endif
+-  #include <net/ip_vs.h>
++  #include <linux/ip_vs.h>
+ #endif
+ 
+ #ifndef IP_VS_TEMPLATE_TIMEOUT
+--- keepalived-1.1.20-orig/keepalived/libipvs-2.4/libipvs.h
++++ keepalived-1.1.20/keepalived/libipvs-2.4/libipvs.h
+@@ -10,7 +10,7 @@
+ #ifndef _LIBIPVS_H
+ #define _LIBIPVS_H
+ 
+-#include <net/ip_vs.h>
++#include <linux/ip_vs.h>
+ 
+ /*
+  * The default IPVS_SVC_PERSISTENT_TIMEOUT is a little larger than average
+--- keepalived-1.1.20-orig/keepalived/libipvs-2.6/libipvs.h
++++ keepalived-1.1.20/keepalived/libipvs-2.6/libipvs.h
+@@ -10,7 +10,7 @@
+ #ifndef _LIBIPVS_H
+ #define _LIBIPVS_H
+ 
+-#include <net/ip_vs.h>
++#include <linux/ip_vs.h>
+ 
+ #define MINIMUM_IPVS_VERSION_MAJOR      1
+ #define MINIMUM_IPVS_VERSION_MINOR      1
diff --git a/testing/keepalived/keepalived.confd b/testing/keepalived/keepalived.confd
new file mode 100644
index 0000000..87094b3
--- /dev/null
+++ b/testing/keepalived/keepalived.confd
@@ -0,0 +1,7 @@
+# keepalived config file
+# default: /etc/keepalived/keepalived.conf
+#KEEPALIVED_CFG=/etc/keepalived
+
+# extra options for keepalived
+#KEEPALIVED_OPTS="" # you must NOT use -f here!
+
diff --git a/testing/keepalived/keepalived.initd b/testing/keepalived/keepalived.initd
new file mode 100755
index 0000000..a5b2bb9
--- /dev/null
+++ b/testing/keepalived/keepalived.initd
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+KEEPALIVED_BIN="/usr/sbin/keepalived"
+KEEPALIVED_CFG=${KEEPALIVED_CFG:-/etc/keepalived/keepalived.conf}
+
+depend() {
+	use logger
+	need net
+	after firewall
+}
+
+start() {
+	ebegin "Starting keepalived"
+	start-stop-daemon --start --exec "${KEEPALIVED_BIN}" \
+		-- -f "${KEEPALIVED_CFG}" ${KEEPALIVED_OPTS}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping keepalived"
+	start-stop-daemon --stop --exec "${KEEPALIVED_BIN}"
+	eend $?
+}
-- 
1.7.3.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---