summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/heartbeat')
-rw-r--r--sys-cluster/heartbeat/ChangeLog87
-rw-r--r--sys-cluster/heartbeat/Manifest14
-rw-r--r--sys-cluster/heartbeat/files/heartbeat-2.1.3-dopd-47f60bebe7b2.patch110
-rw-r--r--sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear-rewrite.patch60
-rw-r--r--sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear.patch13
-rw-r--r--sys-cluster/heartbeat/files/heartbeat-2.1.3-lrm-op_status.patch14
-rw-r--r--sys-cluster/heartbeat/files/heartbeat-2.1.3-lrmadmin-cts.patch12
-rw-r--r--sys-cluster/heartbeat/files/heartbeat-2.1.3-nocrm-dopd.patch10
-rw-r--r--sys-cluster/heartbeat/files/heartbeat.init-r2133
-rw-r--r--sys-cluster/heartbeat/heartbeat-2.1.3-r5.ebuild232
-rw-r--r--sys-cluster/heartbeat/heartbeat-2.1.4.ebuild202
-rw-r--r--sys-cluster/heartbeat/heartbeat-2.99.0_beta.ebuild180
12 files changed, 1067 insertions, 0 deletions
diff --git a/sys-cluster/heartbeat/ChangeLog b/sys-cluster/heartbeat/ChangeLog
new file mode 100644
index 0000000..0510941
--- /dev/null
+++ b/sys-cluster/heartbeat/ChangeLog
@@ -0,0 +1,87 @@
+# ChangeLog for sys-cluster/heartbeat
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+ 09 Sep 2008; Wolfram Schlich <wschlich@gentoo.org>
+ heartbeat-2.1.3-r5.ebuild, heartbeat-2.1.4.ebuild,
+ +heartbeat-2.99.0_beta.ebuild:
+ *DEPEND fixed, ebuild cleanups, version bump
+
+ 18 Aug 2008; Wolfram Schlich <wschlich@gentoo.org>
+ +heartbeat-2.1.4.ebuild:
+ version bump
+
+ 14 Aug 2008; Wolfram Schlich <wschlich@gentoo.org>
+ -files/heartbeat.init-r1, +files/heartbeat.init-r2,
+ -heartbeat-2.1.3-r4.ebuild, +heartbeat-2.1.3-r5.ebuild:
+ modify init script to NOT start heartbeat with increased priority (-10)
+ anymore because all started resources also were started with that priority
+
+ 23 Jul 2008; Wolfram Schlich <wschlich@gentoo.org>
+ +files/heartbeat.init-r1, -files/heartbeat-init,
+ -heartbeat-2.1.3-r3.ebuild, +heartbeat-2.1.3-r4.ebuild:
+ modify init script to be POSIX compliant (useful for baselayout-2/openrc)
+ and to start heartbeat with increased priority (-10)
+
+ 03 Jul 2008; Wolfram Schlich <wschlich@gentoo.org>
+ -files/drbd-peer-outdater.sh, -heartbeat-2.1.3-r1.ebuild,
+ -heartbeat-2.1.3-r2.ebuild, -heartbeat-2.1.3_p15-r10.ebuild:
+ removed old versions
+
+ 27 Mar 2008; Wolfram Schlich <wschlich@gentoo.org>
+ +files/heartbeat-2.1.3-leapyear-rewrite.patch,
+ +files/heartbeat-2.1.3-lrmadmin-cts.patch, heartbeat-2.1.3-r3.ebuild:
+ added revised leapyear patch, added lrmadmin patch to make the CTS happy,
+ remove drbd-peer-outdater wrapper and corresponding warning
+
+ 26 Mar 2008; Wolfram Schlich <wschlich@gentoo.org>
+ +files/heartbeat-2.1.3-dopd-47f60bebe7b2.patch,
+ +heartbeat-2.1.3-r3.ebuild:
+ incorporate critical dopd patch from
+ http://hg.linux-ha.org/dev/rev/47f60bebe7b2
+
+ 04 Mar 2008; Wolfram Schlich <wschlich@gentoo.org>
+ heartbeat-2.1.3-r1.ebuild:
+ added missing autotools eclass inheritance
+
+ 04 Mar 2008; Wolfram Schlich <wschlich@gentoo.org>
+ -heartbeat-2.1.3.ebuild, -heartbeat-2.1.3_p15-r8.ebuild,
+ +heartbeat-2.1.3_p15-r10.ebuild:
+ version bump, removed old versions
+
+ 29 Feb 2008; Wolfram Schlich <wschlich@gentoo.org>
+ +files/heartbeat-2.1.3-leapyear.patch, heartbeat-2.1.3.ebuild,
+ heartbeat-2.1.3-r1.ebuild, heartbeat-2.1.3-r2.ebuild,
+ heartbeat-2.1.3_p15-r8.ebuild:
+ add leap year patch from
+ http://developerbugs.linux-foundation.org/show_bug.cgi?id=1849 (do NOT
+ install this on 29th of february\!)
+
+ 28 Feb 2008; Wolfram Schlich <wschlich@gentoo.org>
+ +files/drbd-peer-outdater.sh, heartbeat-2.1.3.ebuild,
+ heartbeat-2.1.3-r1.ebuild, heartbeat-2.1.3-r2.ebuild,
+ heartbeat-2.1.3_p15-r8.ebuild:
+ provide a wrapper script for drbd-peer-outdater
+
+ 28 Feb 2008; Wolfram Schlich <wschlich@gentoo.org>
+ -heartbeat-2.1.2.ebuild:
+ remove old version
+
+ 28 Feb 2008; Wolfram Schlich <wschlich@gentoo.org>
+ -heartbeat-2.1.3_p15-r1.ebuild:
+ remove old version
+
+ 28 Feb 2008; Wolfram Schlich <wschlich@gentoo.org>
+ -files/heartbeat-2.0.8-crm-leaks.patch,
+ -files/heartbeat-2.0.8-delay.patch, -heartbeat-2.0.8-r2.ebuild:
+ remove old version
+
+ 28 Feb 2008; Wolfram Schlich <wschlich@gentoo.org>
+ +heartbeat-2.1.3_p15-r8.ebuild:
+ version bump
+
+ 28 Feb 2008; Wolfram Schlich <wschlich@gentoo.org> heartbeat-2.1.3.ebuild,
+ heartbeat-2.1.3-r1.ebuild, heartbeat-2.1.3-r2.ebuild,
+ heartbeat-2.1.3_p15-r1.ebuild:
+ added python + pyxml deps for ciblint + crm_sh
+
diff --git a/sys-cluster/heartbeat/Manifest b/sys-cluster/heartbeat/Manifest
new file mode 100644
index 0000000..ce6aa14
--- /dev/null
+++ b/sys-cluster/heartbeat/Manifest
@@ -0,0 +1,14 @@
+AUX heartbeat-2.1.3-dopd-47f60bebe7b2.patch 4349 RMD160 67cffb5d20f18c67ede9d31cf54f9a4490688f89 SHA1 48fbde8fd5768c110f41287f3dabf12f07700109 SHA256 91db17608a16534e6093979a0a4a699ebf6c85e06da40faafd031646ba41211c
+AUX heartbeat-2.1.3-leapyear-rewrite.patch 1914 RMD160 06a01ba33fdc741428686c6260123ca90b46c7e1 SHA1 9b152a6d839f73de8dc08216298e2e7672a6333c SHA256 16694ff6b46fa2d6b9fc5493d32c0cd74086bb03c84c69873f58fd72f70b2144
+AUX heartbeat-2.1.3-leapyear.patch 434 RMD160 9c6346a5fa31ffcb7a59a836f99825d9958961a8 SHA1 e983d014aed4eaf400311a8f255c6dcdbd33cca6 SHA256 95128a654714c28a1184255a82e66ce06c83a33d75d1a700e12e611544a0da1d
+AUX heartbeat-2.1.3-lrm-op_status.patch 439 RMD160 2bba0b59c98442e9ef2638703ea2c7cf72a1ad94 SHA1 3b7ba193230e20929658ace332f7a5de37e2a420 SHA256 98a97ecb4c61953b4b7edf15662d4a64a344ad9f6a435e51fc0e43695c383183
+AUX heartbeat-2.1.3-lrmadmin-cts.patch 451 RMD160 dd2a8e565d1b206aa87e8507a0d2409affbfbf79 SHA1 468adb7d1d3fac121ee694985ea160a8a6bc5211 SHA256 5a535e8a9e20999a125a954f2db3e52d38bb83870bf5b6e9411b345b937d0643
+AUX heartbeat-2.1.3-nocrm-dopd.patch 306 RMD160 0809d1a47be005febc5135f9951e131df2e58b6c SHA1 54f84d32e0ed4f8375c1a255ef74aebd103226ed SHA256 c41035a0dfcfa97dce756de7dcd321baa5474f59220688ce93a6dbaa346e13e9
+AUX heartbeat.init-r2 2806 RMD160 44e9c63f4a9b5b865068de3458bbc81498fde1c5 SHA1 4473d7a55f4ff9a8f48cd58bc8806ad84524ca6b SHA256 b39e7f2e0909c161d06df7c6466ef12c543cc1bf9af172997eefc1f63b78d2d0
+DIST STABLE-2.1.4.tar.bz2 1914005 RMD160 08b952c3c58edb64606299db1677c5ba73c5d8c9 SHA1 f5b9beb9c2af71e53cc8aaf69699377f9e3404bb SHA256 00483fcbaf7bdb43fd59f547c387167aac4c3fffffb09e219cff9f17fa43ba6a
+DIST beta-2.99.0.tar.bz2 1105297 RMD160 3fb643b99d340ca03e174ed7db05141dba329d92 SHA1 cd29f160f738a7453719fe16b38a21ac7777065e SHA256 38462b486347726216454eabf11ec293f19b1486e4307e44542c9939f3efb900
+DIST heartbeat-2.1.3.tar.gz 3679620 RMD160 1eed127aa84e686131be890549cee5749e5443eb SHA1 97577ac6e96670cc3920fce1f1cfcda8d49d310b SHA256 15443b9cbad55be58d76270da0fbbeb625d64eafba8c5963750573b4f9a12e24
+EBUILD heartbeat-2.1.3-r5.ebuild 6985 RMD160 b18612a2feb0e18ed9ad206bbe4cd3834a803283 SHA1 4c9aafdc79a01e058314c70c4205a86ffeb37412 SHA256 4c86c9487ba4729f54720afd4c6895121c4bbe204f4e607b7f08ddf8a6143fd1
+EBUILD heartbeat-2.1.4.ebuild 5927 RMD160 70dbc383f92da482b47049774b18f51d050e8b34 SHA1 19d04e0356f10c29f63c333390c7f7062e0cc7f8 SHA256 5532b3cb7a2424b753aa9bb831fb0c04b099b3f42d46cadc550ed1a81fcb8fde
+EBUILD heartbeat-2.99.0_beta.ebuild 5400 RMD160 733f9cce1a54d7be082a2a34d30b7d781212303e SHA1 6a8ef4094fb39062b9028fe38ac856a0cec37387 SHA256 94e35052785e0e9dbba40714c6b1686394cf55f894231d54875f1bbef5f10e73
+MISC ChangeLog 3369 RMD160 6fd81e6caf4cb5479d32a9f0db1af4e500037971 SHA1 eca60dea7a7f2315fa21fae92db592a10e372123 SHA256 78cbe5e0e3acc1bab3cba0084d319216694b81047ebb8b3b2a801c91ac382aab
diff --git a/sys-cluster/heartbeat/files/heartbeat-2.1.3-dopd-47f60bebe7b2.patch b/sys-cluster/heartbeat/files/heartbeat-2.1.3-dopd-47f60bebe7b2.patch
new file mode 100644
index 0000000..87f5d45
--- /dev/null
+++ b/sys-cluster/heartbeat/files/heartbeat-2.1.3-dopd-47f60bebe7b2.patch
@@ -0,0 +1,110 @@
+
+# HG changeset patch
+# User Rasto Levrinc <rasto@linbit.com>
+# Date 1206539836 -3600
+# Node ID 47f60bebe7b25abd88ea7b5488e66dfe187416ae
+# Parent 17c0cf487322287d0689a036c32f21b900ce5a80
+dopd: fix basic failover; fix hb message corruption by fprintf(stderr)
+
+check_drbd_peer() used to return FALSE for "node name not in node list",
+so drbd-peer-outdater returned "invalid nodename".
+Then the semantic changed, and check_drbd_peer learned about "dead" peers
+and returned FALSE for them as well. Which made basic failover impossible :(
+
+The return code was now changed to "peer unreachable" for a dead peer.
+And even for nodes which really are not in the host list (and thus could be
+classified as invalide), because, after all, thats what they are.
+unreachable.
+
+Node name comparison needs to be case insensitive; fixed.
+
+During testing with 15 concurrent drbd resources several dopd crashes have been
+observed, which after some debugging turned out to be simply a wrong assumption
+about the global availability of stderr: some fprintf(stderr, "debug message")
+had accidentally used the heartbeat communication channel file descriptor,
+which seriously confused the comm layer.
+All those fprintfs have now been changed to use cl_log.
+
+--- a/contrib/drbd-outdate-peer/dopd.c Mon Mar 24 16:14:12 2008 +0100
++++ b/contrib/drbd-outdate-peer/dopd.c Wed Mar 26 14:57:16 2008 +0100
+@@ -202,14 +202,17 @@ msg_outdate_rc(struct ha_msg *msg_in, vo
+ }
+
+ /* check_drbd_peer()
+- * walk the nodes and return TRUE if peer is not this node and it exists.
++ * walk the nodes and return
++ * FALSE if peer is not found, not a "normal" node, or "dead"
++ * (no point in trying to reach those nodes).
++ * TRUE if peer is found to be alive and "normal".
+ */
+ gboolean
+ check_drbd_peer(const char *drbd_peer)
+ {
+ const char *node;
+ gboolean found = FALSE;
+- if (!strcmp(drbd_peer, node_name)) {
++ if (!strcasecmp(drbd_peer, node_name)) {
+ cl_log(LOG_WARNING, "drbd peer node %s is me!\n", drbd_peer);
+ return FALSE;
+ }
+@@ -306,9 +309,9 @@ outdater_callback(IPC_Channel *client, g
+ } else
+ pthread_mutex_unlock(&conn_mutex);
+ } else {
+- /* wrong peer was specified,
+- send return code 20 to the client */
+- send_to_client(curr_client, "20");
++ /* peer "dead" or not in node list.
++ * return "peer could not be reached" */
++ send_to_client(curr_client, "5");
+ }
+
+ ha_msg_del(msg);
+--- a/contrib/drbd-outdate-peer/drbd-peer-outdater.c Mon Mar 24 16:14:12 2008 +0100
++++ b/contrib/drbd-outdate-peer/drbd-peer-outdater.c Wed Mar 26 14:57:16 2008 +0100
+@@ -76,7 +76,7 @@ outdate_callback(IPC_Channel * server, g
+
+ msg = msgfromIPC_noauth(server);
+ if (!msg) {
+- fprintf(stderr, "no message from server or other "
++ cl_log(LOG_WARNING, "no message from server or other "
+ "instance is running\n");
+ if (client->mainloop != NULL &&
+ g_main_is_running(client->mainloop))
+@@ -92,7 +92,7 @@ outdate_callback(IPC_Channel * server, g
+ errno = 0;
+ rc = strtol(rc_string, &ep, 10);
+ if (errno != 0 || *ep != EOS) {
+- fprintf(stderr, "unknown message: %s from server", rc_string);
++ cl_log(LOG_WARNING, "unknown message: %s from server", rc_string);
+ client->rc = 20; /* "officially undefined", unspecified error */
+ ha_msg_del(msg);
+ if (client->mainloop != NULL &&
+@@ -124,7 +124,7 @@ outdater_timeout_dispatch(gpointer user_
+ outdater_timeout_dispatch(gpointer user_data)
+ {
+ dop_client_t *client = (dop_client_t *)user_data;
+- fprintf(stderr, "error: could not connect to dopd after %i seconds"
++ cl_log(LOG_WARNING, "error: could not connect to dopd after %i seconds"
+ ": timeout reached\n", client->timeout);
+ if (client->mainloop != NULL && g_main_is_running(client->mainloop))
+ g_main_quit(client->mainloop);
+@@ -255,7 +255,7 @@ main(int argc, char ** argv)
+ (gpointer)new_client, &ipc_server);
+
+ if (ipc_server == NULL) {
+- fprintf(stderr, "Could not connect to "T_OUTDATER" channel\n");
++ cl_log(LOG_WARNING, "Could not connect to "T_OUTDATER" channel\n");
+ dop_exit(new_client); /* unreachable */
+ }
+
+@@ -267,7 +267,7 @@ main(int argc, char ** argv)
+ ha_msg_add(update, F_OUTDATER_RES, drbd_resource);
+
+ if (msg2ipcchan(update, ipc_server) != HA_OK) {
+- fprintf(stderr, "Could not send message\n");
++ cl_log(LOG_WARNING, "Could not send message\n");
+ dop_exit(new_client);
+ }
+
+
diff --git a/sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear-rewrite.patch b/sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear-rewrite.patch
new file mode 100644
index 0000000..97bb590
--- /dev/null
+++ b/sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear-rewrite.patch
@@ -0,0 +1,60 @@
+diff -r c70d0fa6579c lib/crm/common/iso8601.c
+--- a/lib/crm/common/iso8601.c Mon Mar 03 14:11:11 2008 +0800
++++ b/lib/crm/common/iso8601.c Fri Feb 29 12:35:56 2008 +0100
+@@ -649,13 +649,14 @@ convert_from_ordinal(ha_time_t *a_date)
+
+ gboolean ordinal_to_gregorian(ha_time_t *a_date)
+ {
++ /* Day of the year this month ends on */
++ int m_end = 0;
++
+ CRM_CHECK(a_date->has->years, return FALSE);
+ CRM_CHECK(a_date->has->yeardays, return FALSE);
+
+ CRM_CHECK(a_date->yeardays > 0, return FALSE);
+
+- a_date->days = a_date->yeardays;
+- a_date->months = 11;
+ if(is_leap_year(a_date->years) && a_date->yeardays > 366) {
+ crm_err("Year %.4d only has 366 days (supplied %.3d)",
+ a_date->years, a_date->yeardays);
+@@ -667,27 +668,21 @@ gboolean ordinal_to_gregorian(ha_time_t
+ a_date->yeardays = 365;
+ }
+
+- while(a_date->months > 0
+- && a_date->yeardays <= month2days[a_date->months]) {
+- crm_debug_6("month %d: %d vs. %d",
++ a_date->days = a_date->yeardays;
++ a_date->months = 0;
++ do {
++ a_date->months++;
++ m_end += days_per_month(a_date->months, a_date->years);
++ a_date->days -= days_per_month(a_date->months-1, a_date->years);
++
++ crm_debug_6("month %d: %d vs. %d - current day: %d",
+ a_date->months, a_date->yeardays,
+- month2days[a_date->months]);
+- (a_date->months)--;
+- }
++ m_end, a_date->days);
++ } while (a_date->months < 12 && m_end < a_date->yeardays);
+
+- a_date->days -= month2days[a_date->months];
+- (a_date->months)++;
+-
+ CRM_CHECK(a_date->months > 0, return FALSE);
+-
+- if(is_leap_year(a_date->years) && a_date->months > 2) {
+- (a_date->days)--;
+- }
+- if(a_date->days == 0) {
+- /* annoying underflow */
+- a_date->days = days_per_month(a_date->months, a_date->years);
+- (a_date->months)--;
+- }
++ CRM_CHECK(a_date->days <= days_per_month(a_date->months, a_date->years),
++ return FALSE);
+
+ a_date->has->days = TRUE;
+ a_date->has->months = TRUE;
diff --git a/sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear.patch b/sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear.patch
new file mode 100644
index 0000000..aaea0ae
--- /dev/null
+++ b/sys-cluster/heartbeat/files/heartbeat-2.1.3-leapyear.patch
@@ -0,0 +1,13 @@
+diff -r 4a3eac571f44 lib/crm/common/iso8601.c
+--- a/lib/crm/common/iso8601.c Fri Dec 21 08:25:17 2007 -0700
++++ b/lib/crm/common/iso8601.c Fri Feb 29 15:01:10 2008 +0100
+@@ -677,8 +677,8 @@ gboolean ordinal_to_gregorian(ha_time_t
+ }
+ if(a_date->days == 0) {
+ /* annoying underflow */
++ (a_date->months)--;
+ a_date->days = days_per_month(a_date->months, a_date->years);
+- (a_date->months)--;
+ }
+
+ a_date->has->days = TRUE;
diff --git a/sys-cluster/heartbeat/files/heartbeat-2.1.3-lrm-op_status.patch b/sys-cluster/heartbeat/files/heartbeat-2.1.3-lrm-op_status.patch
new file mode 100644
index 0000000..1c7fb14
--- /dev/null
+++ b/sys-cluster/heartbeat/files/heartbeat-2.1.3-lrm-op_status.patch
@@ -0,0 +1,14 @@
+diff -r 98aeb5f25c95 lib/lrm/clientlib.c
+--- a/lib/lrm/clientlib.c Fri Feb 15 17:53:27 2008 +0100
++++ b/lib/lrm/clientlib.c Fri Feb 15 17:53:56 2008 +0100
+@@ -1190,10 +1190,6 @@ msg_to_op(struct ha_msg* msg)
+ else {
+ op->output = NULL;
+ }
+- /* check the rc to revise the op_status */
+- if (0 != op->rc) {
+- op->op_status = LRM_OP_ERROR;
+- }
+ } else if(op->op_status == LRM_OP_PENDING) {
+ op->rc = EXECRA_STATUS_UNKNOWN;
+
diff --git a/sys-cluster/heartbeat/files/heartbeat-2.1.3-lrmadmin-cts.patch b/sys-cluster/heartbeat/files/heartbeat-2.1.3-lrmadmin-cts.patch
new file mode 100644
index 0000000..7fa5435
--- /dev/null
+++ b/sys-cluster/heartbeat/files/heartbeat-2.1.3-lrmadmin-cts.patch
@@ -0,0 +1,12 @@
+diff -r 54723736ab18 lrm/admin/lrmadmin.c
+--- a/lrm/admin/lrmadmin.c Wed Mar 26 16:17:00 2008 +0100
++++ b/lrm/admin/lrmadmin.c Fri Mar 21 01:58:20 2008 +0100
+@@ -607,7 +607,7 @@ lrm_op_done_callback(lrm_op_t* op)
+ printf("return code: %d\n", op->rc);
+ printf("output data: \n%s\n", (op->output ? op->output : "[null]"));
+ printf("---------------------------------------\n\n");
+- ret_value = op->op_status;
++ ret_value = op->rc;
+ }
+
+ static int
diff --git a/sys-cluster/heartbeat/files/heartbeat-2.1.3-nocrm-dopd.patch b/sys-cluster/heartbeat/files/heartbeat-2.1.3-nocrm-dopd.patch
new file mode 100644
index 0000000..82b3222
--- /dev/null
+++ b/sys-cluster/heartbeat/files/heartbeat-2.1.3-nocrm-dopd.patch
@@ -0,0 +1,10 @@
+--- configure.in.orig 2008-02-15 01:13:20.218146974 +0100
++++ configure.in 2008-02-15 01:16:24.813180157 +0100
+@@ -2516,7 +2516,6 @@
+ fi
+ dnl None of the following items build without the CRM available
+ enable_mgmt=no
+- enable_dopd=no
+ enable_cim_provider=no
+ fi
+ AC_SUBST(CRM_DIR)
diff --git a/sys-cluster/heartbeat/files/heartbeat.init-r2 b/sys-cluster/heartbeat/files/heartbeat.init-r2
new file mode 100644
index 0000000..45b0deb
--- /dev/null
+++ b/sys-cluster/heartbeat/files/heartbeat.init-r2
@@ -0,0 +1,133 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+opts="${opts} reload"
+
+HA_DIR='/etc/ha.d'
+
+depend() {
+ use logger
+ need net
+}
+
+checkconfig() {
+ # check for base directory
+ if ! [ -d "${HA_DIR}" ]; then
+ eerror "HA directory '${HA_DIR}' does not exist"
+ return 1
+ fi
+ # check for shellfuncs
+ local HA_SHELLFUNCS="${HA_DIR}/shellfuncs"
+ if ! [ -e "${HA_SHELLFUNCS}" ]; then
+ eerror "HA shellfuncs file '${HA_SHELLFUNCS}' does not exist"
+ return 1
+ elif ! . "${HA_SHELLFUNCS}"; then
+ eerror "Failed to source HA shell functions '${HA_SHELLFUNCS}'"
+ return 1
+ fi
+ # check for ha.cf
+ local HA_CF="${HA_DIR}/ha.cf"
+ if ! [ -e "${HA_CF}" ]; then
+ eerror "HA config file '${HA_CF}' does not exist"
+ return 1
+ fi
+ # check for haresources if not using the CRM
+ if ! checkbool "$(ha_parameter crm)"; then
+ local HA_RESOURCES="${HA_DIR}/haresources"
+ if ! [ -e "${HA_RESOURCES}" ]; then
+ eerror "HA resources file '${HA_RESOURCES}' does not exist"
+ return 1
+ fi
+ fi
+ # check for authkeys
+ local HA_AUTHKEYS="${HA_DIR}/authkeys"
+ if ! [ -e "${HA_AUTHKEYS}" ]; then
+ eerror "HA authkeys file '${HA_AUTHKEYS}' does not exist"
+ return 1
+ fi
+}
+
+# Check for boolean values
+checkbool() {
+ case $(echo "${1}" | tr '[:upper:]' '[:lower:]') in
+ y|yes|enable|on|true|1) return 0;;
+ *) return 1;;
+ esac
+}
+
+# Run startstop script if it exists
+run_startstop() {
+ if [ -x ${HA_DIR}/resource.d/startstop ]; then
+ ${HA_DIR}/resource.d/startstop "${@}"
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting ${SVCNAME}"
+
+ # start the log subsystem
+ checkbool "$(ha_parameter use_logd)" && {
+ /usr/lib/heartbeat/ha_logd -s &>/dev/null || \
+ /usr/lib/heartbeat/ha_logd -d -c /etc/ha.d/ha_logd.cf
+ }
+
+ run_startstop pre-start
+
+ checkbool "$(ha_parameter crm)" || \
+ /usr/lib/heartbeat/ResourceManager verifyallidle
+
+ # run heartbeat
+ /usr/lib/heartbeat/heartbeat &>/dev/null
+ ret=$?
+
+ run_startstop post-start
+
+ eend ${ret}
+}
+
+stop() {
+ checkconfig || return 1
+ ebegin "Stopping heartbeat"
+
+ run_startstop pre-stop
+
+ /usr/lib/heartbeat/heartbeat -k &>/dev/null
+ ret=$?
+
+ run_startstop post-stop ${ret}
+
+ # stop log subsystem
+ checkbool "$(ha_parameter use_logd)" && {
+ /usr/lib/heartbeat/ha_logd -s &>/dev/null && \
+ /usr/lib/heartbeat/ha_logd -k &>/dev/null
+ }
+
+ eend ${ret}
+}
+
+status() {
+ checkconfig || return 1
+ ebegin "Checking for ${SVCNAME}"
+ /usr/lib/heartbeat/heartbeat -s
+ eend $?
+}
+
+reload() {
+ checkconfig || return 1
+ ebegin "Reloading ${SVCNAME}"
+ /usr/lib/heartbeat/heartbeat -r &>/dev/null
+ eend $?
+}
+
+restart() {
+ checkconfig || return 1
+ let sleeptime=$(ha_parameter deadtime)+10
+ svc_stop
+ ebegin "Waiting ${sleeptime}s to allow resource takeover to complete"
+ sleep ${sleeptime}
+ eend 0
+ svc_start
+}
diff --git a/sys-cluster/heartbeat/heartbeat-2.1.3-r5.ebuild b/sys-cluster/heartbeat/heartbeat-2.1.3-r5.ebuild
new file mode 100644
index 0000000..961eb3c
--- /dev/null
+++ b/sys-cluster/heartbeat/heartbeat-2.1.3-r5.ebuild
@@ -0,0 +1,232 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit autotools eutils flag-o-matic
+
+DESCRIPTION="Heartbeat High-Availability Cluster Manager"
+HOMEPAGE="http://www.linux-ha.org"
+SRC_URI="http://www.linux-ha.org/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="crm doc ipmi ldirectord snmp"
+
+RDEPEND="
+ =dev-libs/glib-2*
+ dev-libs/libxml2
+ net-libs/libnet
+ >=dev-lang/perl-5.8.8
+ >=dev-lang/python-2.4
+ >=dev-python/pyxml-0.8
+ net-misc/iputils
+ virtual/ssh
+ net-libs/gnutls
+ ldirectord? (
+ sys-cluster/ipvsadm
+ dev-perl/Net-DNS
+ dev-perl/libwww-perl
+ dev-perl/perl-ldap
+ virtual/perl-libnet
+ dev-perl/Crypt-SSLeay
+ dev-perl/HTML-Parser
+ dev-perl/perl-ldap
+ dev-perl/Mail-IMAPClient
+ dev-perl/Mail-POP3Client
+ dev-perl/MailTools
+ )
+ snmp? ( net-analyzer/net-snmp )
+ net-misc/telnet-bsd
+ ipmi? (
+ >=sys-libs/openipmi-2
+ )
+"
+DEPEND="${RDEPEND}
+ dev-lang/swig
+ dev-util/pkgconfig
+"
+
+# let the user override the user and group defaults
+# WARNING! ATTENTION! if you plan to use DRBD for cluster storage,
+# please note that /sbin/drbdmeta and /sbin/drbdsetup need to
+# be SUID root and executable by ${HA_GROUP_NAME}!
+# otherwise, Heartbeat will not be able to handle DRBD correctly.
+test -z "${HA_GROUP_ID}" && HA_GROUP_ID='65'
+test -z "${HA_GROUP_NAME}" && HA_GROUP_NAME='haclient'
+test -z "${HA_USER_ID}" && HA_USER_ID='65'
+test -z "${HA_USER_NAME}" && HA_USER_NAME='hacluster'
+test -z "${HA_USER_HOME}" && HA_USER_HOME='/var/lib/heartbeat'
+
+pkg_setup() {
+ # check for heartbeat/HA group
+ if ! egetent group ${HA_GROUP_NAME} >&/dev/null; then
+ # check for an existing group name with another gid
+ local existing_group_name=$(egetent group ${HA_GROUP_ID} | cut -d : -f 1)
+ if [[ -n "${existing_group_name}" ]] && \
+ [[ "${existing_group_name}" != "${HA_GROUP_NAME}" ]]; then
+ eerror
+ eerror "an existing group with gid '${HA_GROUP_ID}' and a"
+ eerror "name other than '${HA_GROUP_NAME}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the uid to another one."
+ eerror
+ die "system group name problem"
+ fi
+ # create the new group
+ enewgroup ${HA_GROUP_NAME} ${HA_GROUP_ID}
+ else
+ # check for an existing gid with another group name
+ local existing_group_id=$(egetent group ${HA_GROUP_NAME} | cut -d : -f 3)
+ if [[ -n "${existing_group_id}" ]] && \
+ [[ "${existing_group_id}" != "${HA_GROUP_ID}" ]]; then
+ eerror
+ eerror "an existing group with the name '${HA_GROUP_NAME}' and a"
+ eerror "gid other than '${HA_GROUP_ID}' has been found"
+ eerror "on your system. either remove the group or change"
+ eerror "the name to another one."
+ eerror
+ die "system group id problem"
+ fi
+ fi
+
+ # check for heartbeat/HA user
+ if ! egetent passwd ${HA_USER_NAME} >&/dev/null; then
+ # check for an existing user name with another uid
+ local existing_user_name=$(egetent passwd ${HA_USER_ID} | cut -d : -f 1)
+ if [[ -n "${existing_user_name}" ]] && \
+ [[ "${existing_user_name}" != "${HA_USER_NAME}" ]]; then
+ eerror
+ eerror "an existing user with uid '${HA_USER_ID}' and a"
+ eerror "name other than '${HA_USER_NAME}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the uid to another one."
+ eerror
+ die "system user name problem"
+ fi
+ # create the new user
+ enewuser ${HA_USER_NAME} ${HA_USER_ID} -1 ${HA_USER_HOME} ${HA_GROUP_NAME}
+ else
+ # check for an existing uid with another user name
+ local existing_user_id=$(egetent passwd ${HA_USER_NAME} | cut -d : -f 3)
+ if [[ -n "${existing_user_id}" ]] && \
+ [[ "${existing_user_id}" != "${HA_USER_ID}" ]]; then
+ eerror
+ eerror "an existing user with the name '${HA_USER_NAME}' and a"
+ eerror "uid other than '${HA_USER_ID}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the name to another one."
+ eerror
+ die "system user id problem"
+ fi
+ fi
+
+ # check for USE flag constraints
+ if ! use crm && use snmp; then
+ die "USE=snmp requires USE=crm (disable USE=snmp or enable USE=crm)"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ use crm || epatch "${FILESDIR}"/${P}-nocrm-dopd.patch
+
+ # http://developerbugs.linux-foundation.org/show_bug.cgi?id=1833#c6
+ # http://hg.linux-ha.org/dev/rev/54723736ab18
+ epatch "${FILESDIR}"/${P}-lrm-op_status.patch
+ # http://developerbugs.linux-foundation.org/show_bug.cgi?id=1833#c11
+ epatch "${FILESDIR}"/${P}-lrmadmin-cts.patch
+
+ # http://developerbugs.linux-foundation.org/show_bug.cgi?id=1849#c6
+ epatch "${FILESDIR}"/${P}-leapyear-rewrite.patch
+
+ # http://hg.linux-ha.org/dev/rev/47f60bebe7b2
+ epatch "${FILESDIR}"/${P}-dopd-47f60bebe7b2.patch
+
+ eautoreconf
+}
+
+src_compile() {
+ # FIXME
+ if use ipmi; then
+ eerror "Sorry, integrated IPMI STONITH support is broken in 2.1.3."
+ die "Please disable the ipmi USE flag and try again."
+ fi
+ econf \
+ --localstatedir=/var \
+ --with-group-name=${HA_GROUP_NAME} \
+ --with-group-id=${HA_GROUP_ID} \
+ --with-ccmuser-name=${HA_USER_NAME} \
+ --with-ccmuser-id=${HA_USER_ID} \
+ --disable-rpath \
+ --disable-fatal-warnings \
+ $(use_enable snmp) \
+ $(use_enable snmp snmp-subagent) \
+ $(use_enable ipmi ipmilan) \
+ --enable-checkpointd \
+ --enable-quorumd \
+ --enable-dopd \
+ $(use_enable crm) \
+ --enable-lrm \
+ --disable-mgmt \
+ || die "configure failed"
+ emake -j 1 || die "make failed"
+}
+
+src_install() {
+ # FIXME: convert to emake?
+ make DESTDIR="${D}" install || die "make install failed"
+
+ # heartbeat modules need these dirs
+ # FIXME: is this (not) needed?
+ #keepdir /var/lib/heartbeat/ckpt /var/lib/heartbeat/ccm /var/lib/heartbeat
+
+ keepdir \
+ /etc/ha.d/conf \
+ /var/lib/heartbeat/{ccm,ckpt,lrm,fencing} \
+ /var/lib/heartbeat/cores/{${HA_USER_NAME},root,nobody} \
+ /var/run/heartbeat/ccm
+
+ if use crm; then
+ keepdir \
+ /var/lib/heartbeat/crm \
+ /var/lib/heartbeat/pengine \
+ /var/run/heartbeat/crm
+ else
+ rm "${D}"/usr/lib/heartbeat/haresources2cib.py
+ fi
+
+ dosym /usr/sbin/ldirectord /etc/ha.d/resource.d/ldirectord
+
+ if ! useq ldirectord; then
+ rm \
+ "${D}"/etc/init.d/ldirectord
+ "${D}"/etc/logrotate.d/ldirectord \
+ "${D}"/etc/ha.d/resource.d/ldirectord \
+ "${D}"/usr/share/man/man8/supervise-ldirectord-config.8 \
+ "${D}"/usr/share/man/man8/ldirectord.8 \
+ "${D}"/usr/sbin/ldirectord \
+ "${D}"/usr/sbin/supervise-ldirectord-config
+ fi
+
+ newinitd "${FILESDIR}"/heartbeat.init-r2 heartbeat
+
+ dodoc \
+ README \
+ doc/*.{cf,txt} \
+ doc/{haresources,authkeys,AUTHORS,COPYING} \
+ ldirectord/ldirectord.cf
+}
+
+pkg_postinst() {
+ ewarn
+ ewarn "Notice for DRBD users:"
+ ewarn
+ ewarn "DRBD Outdate Peer Daemon (dopd) was broken as of Heartbeat 2.1.3."
+ ewarn "This ebuild includes a patch from the DRBD developers which should"
+ ewarn "fix the corresponding bugs. If you were previously using the"
+ ewarn "provided wrapper script, please switch back to the real"
+ ewarn "drbd-peer-outdater path in /etc/drbd.conf."
+ ewarn
+}
diff --git a/sys-cluster/heartbeat/heartbeat-2.1.4.ebuild b/sys-cluster/heartbeat/heartbeat-2.1.4.ebuild
new file mode 100644
index 0000000..ee3577d
--- /dev/null
+++ b/sys-cluster/heartbeat/heartbeat-2.1.4.ebuild
@@ -0,0 +1,202 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit autotools eutils flag-o-matic
+
+DESCRIPTION="Heartbeat High-Availability Cluster Manager"
+HOMEPAGE="http://www.linux-ha.org"
+SRC_URI="http://hg.linux-ha.org/lha-2.1/archive/STABLE-2.1.4.tar.bz2"
+S="${WORKDIR}/Heartbeat-STABLE-2-1-STABLE-2.1.4"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="crm doc ipmi ldirectord snmp"
+
+RDEPEND="
+ =dev-libs/glib-2*
+ dev-libs/libxml2
+ net-libs/libnet
+ >=dev-lang/perl-5.8.8
+ >=dev-lang/python-2.4
+ >=dev-python/pyxml-0.8
+ net-misc/iputils
+ virtual/ssh
+ net-libs/gnutls
+ ldirectord? (
+ sys-cluster/ipvsadm
+ dev-perl/Net-DNS
+ dev-perl/libwww-perl
+ dev-perl/perl-ldap
+ virtual/perl-libnet
+ dev-perl/Crypt-SSLeay
+ dev-perl/HTML-Parser
+ dev-perl/perl-ldap
+ dev-perl/Mail-IMAPClient
+ dev-perl/Mail-POP3Client
+ dev-perl/MailTools
+ )
+ snmp? ( net-analyzer/net-snmp )
+ net-misc/telnet-bsd
+ ipmi? (
+ >=sys-libs/openipmi-2
+ )
+"
+DEPEND="${RDEPEND}
+ dev-lang/swig
+ dev-util/pkgconfig
+"
+
+# let the user override the user and group defaults
+# WARNING! ATTENTION! if you plan to use DRBD for cluster storage,
+# please note that /sbin/drbdmeta and /sbin/drbdsetup need to
+# be SUID root and executable by ${HA_GROUP_NAME}!
+# otherwise, Heartbeat will not be able to handle DRBD correctly.
+test -z "${HA_GROUP_ID}" && HA_GROUP_ID='65'
+test -z "${HA_GROUP_NAME}" && HA_GROUP_NAME='haclient'
+test -z "${HA_USER_ID}" && HA_USER_ID='65'
+test -z "${HA_USER_NAME}" && HA_USER_NAME='hacluster'
+test -z "${HA_USER_HOME}" && HA_USER_HOME='/var/lib/heartbeat'
+
+pkg_setup() {
+ # check for heartbeat/HA group
+ if ! egetent group ${HA_GROUP_NAME} >&/dev/null; then
+ # check for an existing group name with another gid
+ local existing_group_name=$(egetent group ${HA_GROUP_ID} | cut -d : -f 1)
+ if [[ -n "${existing_group_name}" ]] && \
+ [[ "${existing_group_name}" != "${HA_GROUP_NAME}" ]]; then
+ eerror
+ eerror "an existing group with gid '${HA_GROUP_ID}' and a"
+ eerror "name other than '${HA_GROUP_NAME}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the uid to another one."
+ eerror
+ die "system group name problem"
+ fi
+ # create the new group
+ enewgroup ${HA_GROUP_NAME} ${HA_GROUP_ID}
+ else
+ # check for an existing gid with another group name
+ local existing_group_id=$(egetent group ${HA_GROUP_NAME} | cut -d : -f 3)
+ if [[ -n "${existing_group_id}" ]] && \
+ [[ "${existing_group_id}" != "${HA_GROUP_ID}" ]]; then
+ eerror
+ eerror "an existing group with the name '${HA_GROUP_NAME}' and a"
+ eerror "gid other than '${HA_GROUP_ID}' has been found"
+ eerror "on your system. either remove the group or change"
+ eerror "the name to another one."
+ eerror
+ die "system group id problem"
+ fi
+ fi
+
+ # check for heartbeat/HA user
+ if ! egetent passwd ${HA_USER_NAME} >&/dev/null; then
+ # check for an existing user name with another uid
+ local existing_user_name=$(egetent passwd ${HA_USER_ID} | cut -d : -f 1)
+ if [[ -n "${existing_user_name}" ]] && \
+ [[ "${existing_user_name}" != "${HA_USER_NAME}" ]]; then
+ eerror
+ eerror "an existing user with uid '${HA_USER_ID}' and a"
+ eerror "name other than '${HA_USER_NAME}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the uid to another one."
+ eerror
+ die "system user name problem"
+ fi
+ # create the new user
+ enewuser ${HA_USER_NAME} ${HA_USER_ID} -1 ${HA_USER_HOME} ${HA_GROUP_NAME}
+ else
+ # check for an existing uid with another user name
+ local existing_user_id=$(egetent passwd ${HA_USER_NAME} | cut -d : -f 3)
+ if [[ -n "${existing_user_id}" ]] && \
+ [[ "${existing_user_id}" != "${HA_USER_ID}" ]]; then
+ eerror
+ eerror "an existing user with the name '${HA_USER_NAME}' and a"
+ eerror "uid other than '${HA_USER_ID}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the name to another one."
+ eerror
+ die "system user id problem"
+ fi
+ fi
+
+ # check for USE flag constraints
+ if ! use crm && use snmp; then
+ die "USE=snmp requires USE=crm (disable USE=snmp or enable USE=crm)"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ eautoreconf
+}
+
+src_compile() {
+ econf \
+ --localstatedir=/var \
+ --with-group-name=${HA_GROUP_NAME} \
+ --with-group-id=${HA_GROUP_ID} \
+ --with-ccmuser-name=${HA_USER_NAME} \
+ --with-ccmuser-id=${HA_USER_ID} \
+ --disable-rpath \
+ --disable-fatal-warnings \
+ $(use_enable snmp) \
+ $(use_enable snmp snmp-subagent) \
+ $(use_enable ipmi ipmilan) \
+ --enable-checkpointd \
+ --enable-quorumd \
+ --enable-dopd \
+ $(use_enable crm) \
+ --enable-lrm \
+ --disable-mgmt \
+ || die "configure failed"
+ emake -j 1 || die "make failed"
+}
+
+src_install() {
+ # FIXME: convert to emake?
+ make DESTDIR="${D}" install || die "make install failed"
+
+ # heartbeat modules need these dirs
+ # FIXME: is this (not) needed?
+ #keepdir /var/lib/heartbeat/ckpt /var/lib/heartbeat/ccm /var/lib/heartbeat
+
+ keepdir \
+ /etc/ha.d/conf \
+ /var/lib/heartbeat/{ccm,ckpt,lrm,fencing} \
+ /var/lib/heartbeat/cores/{${HA_USER_NAME},root,nobody} \
+ /var/run/heartbeat/ccm
+
+ if use crm; then
+ keepdir \
+ /var/lib/heartbeat/crm \
+ /var/lib/heartbeat/pengine \
+ /var/run/heartbeat/crm
+ else
+ rm "${D}"/usr/lib/heartbeat/haresources2cib.py
+ fi
+
+ dosym /usr/sbin/ldirectord /etc/ha.d/resource.d/ldirectord
+
+ if ! useq ldirectord; then
+ rm \
+ "${D}"/etc/init.d/ldirectord \
+ "${D}"/etc/logrotate.d/ldirectord \
+ "${D}"/etc/ha.d/resource.d/ldirectord \
+ "${D}"/usr/share/man/man8/supervise-ldirectord-config.8 \
+ "${D}"/usr/share/man/man8/ldirectord.8 \
+ "${D}"/usr/sbin/ldirectord \
+ "${D}"/usr/sbin/supervise-ldirectord-config
+ fi
+
+ newinitd "${FILESDIR}"/heartbeat.init-r2 heartbeat
+
+ dodoc \
+ README \
+ doc/*.{cf,txt} \
+ doc/{haresources,authkeys,AUTHORS,COPYING} \
+ ldirectord/ldirectord.cf
+}
diff --git a/sys-cluster/heartbeat/heartbeat-2.99.0_beta.ebuild b/sys-cluster/heartbeat/heartbeat-2.99.0_beta.ebuild
new file mode 100644
index 0000000..d81a3b4
--- /dev/null
+++ b/sys-cluster/heartbeat/heartbeat-2.99.0_beta.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit autotools eutils flag-o-matic
+
+DESCRIPTION="Heartbeat High-Availability Cluster Manager"
+HOMEPAGE="http://www.linux-ha.org"
+SRC_URI="http://hg.linux-ha.org/dev/archive/beta-2.99.0.tar.bz2"
+S="${WORKDIR}/Linux-HA-Dev-beta-2.99.0"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="doc ldirectord"
+
+RDEPEND="
+ =dev-libs/glib-2*
+ dev-libs/libxml2
+ net-libs/libnet
+ >=dev-lang/perl-5.8.8
+ >=dev-lang/python-2.4
+ >=dev-python/pyxml-0.8
+ net-misc/iputils
+ virtual/ssh
+ net-libs/gnutls
+ ldirectord? (
+ sys-cluster/ipvsadm
+ dev-perl/Net-DNS
+ dev-perl/libwww-perl
+ dev-perl/perl-ldap
+ virtual/perl-libnet
+ dev-perl/Crypt-SSLeay
+ dev-perl/HTML-Parser
+ dev-perl/perl-ldap
+ dev-perl/Mail-IMAPClient
+ dev-perl/Mail-POP3Client
+ dev-perl/MailTools
+ )
+ net-misc/telnet-bsd
+"
+DEPEND="${RDEPEND}
+ dev-lang/swig
+ dev-util/pkgconfig
+"
+
+# let the user override the user and group defaults
+# WARNING! ATTENTION! if you plan to use DRBD for cluster storage,
+# please note that /sbin/drbdmeta and /sbin/drbdsetup need to
+# be SUID root and executable by ${HA_GROUP_NAME}!
+# otherwise, Heartbeat will not be able to handle DRBD correctly.
+test -z "${HA_GROUP_ID}" && HA_GROUP_ID='65'
+test -z "${HA_GROUP_NAME}" && HA_GROUP_NAME='haclient'
+test -z "${HA_USER_ID}" && HA_USER_ID='65'
+test -z "${HA_USER_NAME}" && HA_USER_NAME='hacluster'
+test -z "${HA_USER_HOME}" && HA_USER_HOME='/var/lib/heartbeat'
+
+pkg_setup() {
+ # check for heartbeat/HA group
+ if ! egetent group ${HA_GROUP_NAME} >&/dev/null; then
+ # check for an existing group name with another gid
+ local existing_group_name=$(egetent group ${HA_GROUP_ID} | cut -d : -f 1)
+ if [[ -n "${existing_group_name}" ]] && \
+ [[ "${existing_group_name}" != "${HA_GROUP_NAME}" ]]; then
+ eerror
+ eerror "an existing group with gid '${HA_GROUP_ID}' and a"
+ eerror "name other than '${HA_GROUP_NAME}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the uid to another one."
+ eerror
+ die "system group name problem"
+ fi
+ # create the new group
+ enewgroup ${HA_GROUP_NAME} ${HA_GROUP_ID}
+ else
+ # check for an existing gid with another group name
+ local existing_group_id=$(egetent group ${HA_GROUP_NAME} | cut -d : -f 3)
+ if [[ -n "${existing_group_id}" ]] && \
+ [[ "${existing_group_id}" != "${HA_GROUP_ID}" ]]; then
+ eerror
+ eerror "an existing group with the name '${HA_GROUP_NAME}' and a"
+ eerror "gid other than '${HA_GROUP_ID}' has been found"
+ eerror "on your system. either remove the group or change"
+ eerror "the name to another one."
+ eerror
+ die "system group id problem"
+ fi
+ fi
+
+ # check for heartbeat/HA user
+ if ! egetent passwd ${HA_USER_NAME} >&/dev/null; then
+ # check for an existing user name with another uid
+ local existing_user_name=$(egetent passwd ${HA_USER_ID} | cut -d : -f 1)
+ if [[ -n "${existing_user_name}" ]] && \
+ [[ "${existing_user_name}" != "${HA_USER_NAME}" ]]; then
+ eerror
+ eerror "an existing user with uid '${HA_USER_ID}' and a"
+ eerror "name other than '${HA_USER_NAME}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the uid to another one."
+ eerror
+ die "system user name problem"
+ fi
+ # create the new user
+ enewuser ${HA_USER_NAME} ${HA_USER_ID} -1 ${HA_USER_HOME} ${HA_GROUP_NAME}
+ else
+ # check for an existing uid with another user name
+ local existing_user_id=$(egetent passwd ${HA_USER_NAME} | cut -d : -f 3)
+ if [[ -n "${existing_user_id}" ]] && \
+ [[ "${existing_user_id}" != "${HA_USER_ID}" ]]; then
+ eerror
+ eerror "an existing user with the name '${HA_USER_NAME}' and a"
+ eerror "uid other than '${HA_USER_ID}' has been found"
+ eerror "on your system. either remove the user or change"
+ eerror "the name to another one."
+ eerror
+ die "system user id problem"
+ fi
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ eautoreconf
+}
+
+src_compile() {
+ econf \
+ --localstatedir=/var \
+ --with-group-name=${HA_GROUP_NAME} \
+ --with-group-id=${HA_GROUP_ID} \
+ --with-ccmuser-name=${HA_USER_NAME} \
+ --with-ccmuser-id=${HA_USER_ID} \
+ --disable-rpath \
+ --disable-fatal-warnings \
+ --disable-snmp \
+ --disable-ipmilan \
+ --disable-quorumd \
+ --enable-dopd \
+ --enable-lrm \
+ || die "configure failed"
+ emake -j 1 || die "make failed"
+}
+
+src_install() {
+ # FIXME: convert to emake?
+ make DESTDIR="${D}" install || die "make install failed"
+
+ # heartbeat modules need these dirs
+ # FIXME: is this (not) needed?
+ #keepdir /var/lib/heartbeat/ckpt /var/lib/heartbeat/ccm /var/lib/heartbeat
+
+ keepdir \
+ /etc/ha.d/conf \
+ /var/lib/heartbeat/{ccm,ckpt,lrm,fencing} \
+ /var/lib/heartbeat/cores/{${HA_USER_NAME},root,nobody} \
+ /var/run/heartbeat/ccm
+
+ dosym /usr/sbin/ldirectord /etc/ha.d/resource.d/ldirectord
+
+ if ! useq ldirectord; then
+ rm \
+ "${D}"/etc/init.d/ldirectord \
+ "${D}"/etc/logrotate.d/ldirectord \
+ "${D}"/etc/ha.d/resource.d/ldirectord \
+ "${D}"/usr/share/man/man8/supervise-ldirectord-config.8 \
+ "${D}"/usr/share/man/man8/ldirectord.8 \
+ "${D}"/usr/sbin/ldirectord \
+ "${D}"/usr/sbin/supervise-ldirectord-config
+ fi
+
+ newinitd "${FILESDIR}"/heartbeat.init-r2 heartbeat
+
+ dodoc \
+ README \
+ doc/*.{cf,txt} \
+ doc/{haresources,authkeys,AUTHORS,COPYING} \
+ ldirectord/ldirectord.cf
+}