Browse Source

first cut for Heartbeat package

Ralf S. Engelschall 21 years ago
parent
commit
93f2e079d2
6 changed files with 331 additions and 0 deletions
  1. 8 0
      heartbeat/authkeys
  2. 26 0
      heartbeat/ha.cf
  3. 6 0
      heartbeat/haresources
  4. 87 0
      heartbeat/heartbeat.patch
  5. 153 0
      heartbeat/heartbeat.spec
  6. 51 0
      heartbeat/rc.heartbeat

+ 8 - 0
heartbeat/authkeys

@@ -0,0 +1,8 @@
+##
+##  authkeys -- Heartbeat authentication keys
+##
+#
+#auth 1
+#1 crc
+#2 sha1 MySecret!
+#3 md5  MySecret!

+ 26 - 0
heartbeat/ha.cf

@@ -0,0 +1,26 @@
+##
+##  ha.cf -- Heartbeat main configuration
+##
+#
+logfile	      @l_prefix@/var/heartbeat/ha.log
+debugfile     @l_prefix@/var/heartbeat/ha.debug
+debug         0
+#
+keepalive     2
+deadtime      30
+warntime      10
+initdead      120
+#
+msgfmt        classic
+auto_failback on
+#
+udpport	      694
+ucast eth0    192.168.1.2
+#
+node          hostname1 hostname2
+#
+#ping         10.10.10.254
+#deadping     30
+#respawn      hacluster @l_prefix@/sbin/ipfail
+#apiauth      ipfail    gid=haclient uid=hacluster
+#

+ 6 - 0
heartbeat/haresources

@@ -0,0 +1,6 @@
+##
+##  haresources -- Heartbeat resource configuration
+##
+#
+hostname1 IPaddr::192.168.1.3/32/eth0 Filesystem::/dev/sda1::/d1::ext3
+#

+ 87 - 0
heartbeat/heartbeat.patch

@@ -0,0 +1,87 @@
+Index: lib/plugins/stonith/apcmastersnmp.c
+--- lib/plugins/stonith/apcmastersnmp.c.orig	2004-09-13 18:36:49 +0200
++++ lib/plugins/stonith/apcmastersnmp.c	2004-09-22 17:16:14 +0200
+@@ -22,6 +22,12 @@
+ #include <portability.h>
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
++#undef PACKAGE
++#undef PACKAGE_BUGREPORT
++#undef PACKAGE_NAME
++#undef PACKAGE_STRING
++#undef PACKAGE_TARNAME
++#undef PACKAGE_VERSION
+ #endif
+ #include <stdio.h>
+ #include <stdlib.h>
+Index: replace/Makefile.in
+--- replace/Makefile.in.orig	2004-09-18 16:26:22 +0200
++++ replace/Makefile.in	2004-09-22 17:16:14 +0200
+@@ -346,7 +346,7 @@
+ 	  rm -f "$${dir}/so_locations"; \
+ 	done
+ libreplace.la: $(libreplace_la_OBJECTS) $(libreplace_la_DEPENDENCIES) 
+-	$(LINK)  $(libreplace_la_LDFLAGS) $(libreplace_la_OBJECTS) $(libreplace_la_LIBADD) $(LIBS)
++	$(LINK)  $(libreplace_la_LDFLAGS) $(libreplace_la_OBJECTS) $(libreplace_la_LIBADD)
+ 
+ mostlyclean-compile:
+ 	-rm -f *.$(OBJEXT)
+Index: configure
+--- configure.orig	2004-09-18 16:25:06 +0200
++++ configure	2004-09-22 17:31:04 +0200
+@@ -2029,13 +2029,11 @@
+ USE_MODULES=0
+ echo Our Host OS: $host_os
+ case "$host_os" in
+-solaris*)	LIBS="-L/usr/local/lib $LIBS"
+-		CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/opt/sfw/include"
++solaris*)
+ 		INIT_EXT=".sh"
+ 		;;
+ 
+-*bsd*)		LIBS="-L/usr/local/lib"
+-		CPPFLAGS="$CPPFLAGS -I/usr/local/include"
++*bsd*)
+ 		INIT_EXT=".sh"
+ 		;;
+ 
+@@ -2107,7 +2105,7 @@
+ docdir=${datadir}/doc/${HB_PKG}-${VERSION}
+ 
+ 
+-HA_VARLIBDIR="${localstatedir}/lib"
++HA_VARLIBDIR="${localstatedir}/heartbeat"
+ 
+ 
+ cat >>confdefs.h <<_ACEOF
+@@ -29823,7 +29821,6 @@
+ 	# We had to eliminate -Wnested-externs because of libtool changes
+         WARNLIST="all missing-prototypes
+ 		missing-declarations
+-		strict-prototypes
+ 		pointer-arith
+ 		write-strings
+ 		cast-qual cast-align
+@@ -38642,7 +38639,7 @@
+ 
+ 
+ 
+-HB_RC_DIR=$sysconfdir/ha.d/rc.d
++HB_RC_DIR=$sysconfdir/rc.d
+ 
+ 
+ cat >>confdefs.h <<_ACEOF
+Index: linux-ha/portability.h
+--- linux-ha/portability.h.orig	2004-04-29 05:12:24.000000000 +0200
++++ linux-ha/portability.h	2004-09-23 13:07:29.240260479 +0200
+@@ -116,10 +116,6 @@
+ #  include <uuid.h>
+ #endif /* HAVE_UUID_H */
+ 
+-#ifdef HAVE_UUID_UUID_H
+-#  include <uuid/uuid.h>
+-#endif /* HAVE_UUID_UUID_H */
+-
+ #ifndef HA_HAVE_NFDS_T 
+ 	typedef unsigned int nfds_t;
+ #endif

+ 153 - 0
heartbeat/heartbeat.spec

@@ -0,0 +1,153 @@
+##
+##  heartbeat.spec -- OpenPKG RPM Specification
+##  Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
+##  Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS 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.
+##
+
+#   package information
+Name:         heartbeat
+Summary:      High-Availability Communication Daemon
+URL:          http://www.linux-ha.org/heartbeat/
+Vendor:       Alan Roberston
+Packager:     The OpenPKG Project
+Distribution: OpenPKG
+Class:        EVAL
+Group:        System
+License:      GPL
+Version:      1.2.3
+Release:      20040923
+
+#   list of sources
+Source0:      http://www.linux-ha.org/download/heartbeat-%{version}.tar.gz
+Source1:      ha.cf
+Source2:      haresources
+Source3:      authkeys
+Source4:      rc.heartbeat
+Patch0:       heartbeat.patch
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20040130, perl, pkgconfig, make, gcc
+PreReq:       OpenPKG, openpkg >= 20040130, perl
+BuildPreReq:  libnet, libxml, uuid, glib, snmp, curl, openssl, gettext, libiconv, getopt
+PreReq:       libnet, libxml, uuid, glib, snmp, curl, openssl, gettext, libiconv, getopt
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    The heartbeat program is one of the core components of the Linux
+    High-Availability (Linux-HA) project. It provides "warm" failover
+    between two nodes in either automatic or controll way. It uses
+    redundant communication links via Ethernet or serial line in
+    broadcast, multicast and unicast mode.
+
+%track
+    prog heartbeat = {
+        version   = %{version}
+        url       = http://www.linux-ha.org/download/
+        regex     = heartbeat-(\d+\.[02468]\.\d+)\.tar\.gz
+    }
+
+%prep
+    #   unpack and patch package
+    %setup -q
+    %patch -p0
+    %{l_shtool} subst -s -q \
+        -e 's;/ha\.d/;/;g' \
+        -e 's;/ha\.d;;g' \
+        `find . -type f -print`
+
+%build
+    #   configure package
+    CC="%{l_cc}" \
+    CFLAGS="%{l_cflags -O}" \
+    CPPFLAGS="%{l_cppflags}" \
+    LDFLAGS="%{l_ldflags}" \
+    LIBS="-lintl -liconv -lgetopt" \
+    ./configure \
+        --prefix=%{l_prefix} \
+        --sysconfdir=%{l_prefix}/etc/heartbeat \
+        --with-initdir=%{l_prefix}/etc/rc.d \
+        --with-group-name=%{l_musr} \
+        --with-group-id=%{l_muid} \
+        --with-ccmuser-name=%{l_musr} \
+        --with-ccmuser-id=%{l_muid} \
+        --disable-shared
+
+    #   build package components
+    %{l_make} %{l_mflags -O}
+
+%install
+    #   install package components
+    rm -rf $RPM_BUILD_ROOT
+    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
+
+    #   strip down installation
+    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
+    rm -f  $RPM_BUILD_ROOT%{l_prefix}/etc/heartbeat/README.config
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.*
+    rm -f  $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/*.sh
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/heartbeat/logrotate.d
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/heartbeat/cts
+    rm -f  $RPM_BUILD_ROOT%{l_prefix}/man/man8/*ldirectord*.8
+    rm -f  $RPM_BUILD_ROOT%{l_prefix}/sbin/*ldirectord*
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/pils
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/stonith
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/heartbeat/plugins
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/run
+    mv  $RPM_BUILD_ROOT%{l_prefix}/lib/heartbeat/heartbeat \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin/heartbeat
+    mv  $RPM_BUILD_ROOT%{l_prefix}/lib/heartbeat/apphbd \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin/apphbd
+    mv  $RPM_BUILD_ROOT%{l_prefix}/lib/heartbeat/ipfail \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin/ipfail
+    mv  $RPM_BUILD_ROOT%{l_prefix}/lib/heartbeat/hb_* \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin/
+    mv  $RPM_BUILD_ROOT%{l_prefix}/lib/heartbeat/ha_* \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin/
+
+    #   install default configuration files
+    %{l_shtool} install -c -m 644 %{l_value -s -a} \
+        %{SOURCE ha.cf} %{SOURCE haresources} \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/heartbeat/
+    %{l_shtool} install -c -m 600 %{l_value -s -a} \
+        %{SOURCE authkeys} $RPM_BUILD_ROOT%{l_prefix}/etc/heartbeat/
+
+    #   install run-command script
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.heartbeat} \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   determine installation files
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+

+ 51 - 0
heartbeat/rc.heartbeat

@@ -0,0 +1,51 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.heartbeat -- Run-Commands
+##
+
+%config
+    heartbeat_enable="$openpkg_rc_def"
+    heartbeat_flags=""
+    heartbeat_log_prolog="true"
+    heartbeat_log_epilog="true"
+    heartbeat_log_numfiles="10"
+    heartbeat_log_minsize="1M"
+    heartbeat_log_complevel="9"
+
+%status -u @l_susr@ -o
+    heartbeat_usable="no"
+    heartbeat_active="no"
+    @l_prefix@/sbin/hearbeat -s >/dev/null 2>&1 && heartbeat_active="yes"
+    echo "heartbeat_enable=\"$heartbeat_enable\""
+    echo "heartbeat_usable=\"$heartbeat_usable\""
+    echo "heartbeat_active=\"$heartbeat_active\""
+
+%start -p 100 -u @l_susr@
+    rcService heartbeat enable yes || exit 0
+    rcService heartbeat active yes && exit 0
+    @l_prefix@/sbin/heartbeat ${heartbeat_flags}
+
+%stop -p 100 -u @l_susr@
+    rcService heartbeat enable yes || exit 0
+    rcService heartbeat active no  && exit 0
+    @l_prefix@/sbin/heartbeat -k
+
+%restart -p 100 -u @l_susr@
+    rcService heartbeat enable yes || exit 0
+    rcService heartbeat active no  && exit 0
+    rc heartbeat stop start
+
+%reload -p 100 -u @l_susr@
+    rcService heartbeat enable yes || exit 0
+    rcService heartbeat active no  && exit 0
+    @l_prefix@/sbin/heartbeat -r
+
+%daily -u @l_susr@
+    rcService heartbeat enable yes || exit 0
+    shtool rotate -f \
+        -n ${heartbeat_log_numfiles} -s ${heartbeat_log_minsize} -d \
+        -z ${heartbeat_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
+        -P "${heartbeat_log_prolog}" \
+        -E "${heartbeat_log_epilog} && rc heartbeat reload" \
+        @l_prefix@/var/heartbeat/ha.log
+