Index: head/sysutils/heartbeat/Makefile =================================================================== --- head/sysutils/heartbeat/Makefile (revision 392671) +++ head/sysutils/heartbeat/Makefile (revision 392672) @@ -1,153 +1,155 @@ # Created by: Scott Kleihege # $FreeBSD$ PORTNAME= heartbeat PORTVERSION= 2.1.4 -PORTREVISION= 24 +PORTREVISION= 25 CATEGORIES= sysutils #MASTER_SITES= http://hg.linux-ha.org/lha-2.1/archive/STABLE-2.1.4.tar.bz2 MASTER_SITES= LOCAL/kuriyama/heartbeat DISTNAME= STABLE-${PORTVERSION} DIST_SUBDIR= heartbeat MAINTAINER= ports@encarnate.com COMMENT= Subsystem for High-Availability Clustering LICENSE= GPLv2 LGPL21 LICENSE_COMB= multi LIB_DEPENDS= libltdl.so:${PORTSDIR}/devel/libltdl \ libgnutls.so:${PORTSDIR}/security/gnutls \ libnet.so:${PORTSDIR}/net/libnet \ libuuid.so:${PORTSDIR}/misc/e2fsprogs-libuuid \ libxml2.so:${PORTSDIR}/textproc/libxml2 BUILD_DEPENDS= bison:${PORTSDIR}/devel/bison -USES= autoreconf cpe gettext gmake libtool pkgconfig python tar:bzip2 \ +USES= autoreconf cpe gettext gmake libtool perl5 pkgconfig python tar:bzip2 \ shebangfix SHEBANG_FILES= ldirectord/ldirectord.in USE_GNOME= glib20 USE_LDCONFIG= yes CPE_VENDOR= linux-ha GNU_CONFIGURE= yes INSTALL_TARGET= install-strip USERS= hacluster GROUPS= haclient CPPFLAGS+= -I${LOCALBASE}/include -I${LOCALBASE}/include/libnet11 LDFLAGS+= -L${LOCALBASE}/lib -L${LOCALBASE}/lib/libnet11 CONFIGURE_ARGS= --localstatedir=/var \ --with-miBsdir=${PREFIX}/snmp/mibs \ --with-initdir=${PREFIX}/etc/rc.d \ --with-group-id=275 \ --with-ccmuser-id=275 \ --with-ocf-root=${PREFIX}/etc/ocf \ --disable-rpath \ --disable-dopd \ --disable-fatal-warnings SUB_FILES= pkg-install pkg-message PKGDEINSTALL= ${PKGINSTALL} PLIST_SUB= USER=${USERS} GROUP=${GROUPS} OPTIONS_DEFINE= MGMT LDIRECTORD APCSNMP DRAC3 DOCS MGMT_DESC= Enable X11 Management Utilities LDIRECTORD_DESC= Enable Linux Director Daemon APCSNMP_DESC= Enable APC SNMP Stonith Device DRAC3_DESC= Enable Dell DRACIII Stonith Device APCSNMP_LIB_DEPENDS= libnetsnmp.so:${PORTSDIR}/net-mgmt/net-snmp DRAC3_LIB_DEPENDS= libcurl.so:${PORTSDIR}/ftp/curl .include .if ${PORT_OPTIONS:MMGMT} BUILD_DEPENDS+= swig:${PORTSDIR}/devel/swig13 RUN_DEPENDS+= ${LOCALBASE}/libdata/pkgconfig/pygtk-2.0.pc:${PORTSDIR}/x11-toolkits/py-gtk2 PLIST_SUB+= MGMT="" .else CONFIGURE_ARGS+= --disable-mgmt PLIST_SUB+= MGMT="@comment " .endif .if ${PORT_OPTIONS:MLDIRECTORD} RUN_DEPENDS+= p5-libwww>=0:${PORTSDIR}/www/p5-libwww \ p5-Mail-Tools>=0:${PORTSDIR}/mail/p5-Mail-Tools USES+= perl5 USE_PERL5= run PLIST_SUB+= LDIRECTORD="" .else CONFIGURE_ARGS+= --disable-ldirectord PLIST_SUB+= LDIRECTORD="@comment " .endif .if ${PORT_OPTIONS:MAPCSNMP} PLIST_SUB+= APCSNMP="" .else PLIST_SUB+= APCSNMP="@comment " .endif .if ${PORT_OPTIONS:MDRAC3} PLIST_SUB+= DRAC3="" .else PLIST_SUB+= DRAC3="@comment " .endif # BladeHPI Stonith Automagic Building .if exists (${STAGEDIR}${PREFIX}/include/openhpi/SaHpi.h) PLIST_SUB+= HPI="" .else PLIST_SUB+= HPI="@comment " .endif # IPMI Lan Stonith Automagic Building .if exists (${STAGEDIR}${PREFIX}/include/ipmilan.h) PLIST_SUB+= IPMI="" .else PLIST_SUB+= IPMI="@comment " .endif # VACM Stonith Automagic Building .if exists (${STAGEDIR}${PREFIX}/include/vacmclient_api.h) PLIST_SUB+= VACM="" .else PLIST_SUB+= VACM="@comment " .endif post-extract: @${MV} ${WRKDIR}/Heartbeat-STABLE-2-1-${DISTNAME} ${WRKSRC} @${CP} -f ${FILESDIR}/heartbeat.in ${WRKSRC}/heartbeat/init.d/ post-patch: + @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \ + ${WRKSRC}/resources/OCF/IPaddr .if ${PORT_OPTIONS:MDOCS} @${REINPLACE_CMD} -e 's|^\(docdir.*doc/\).*|\1${PORTNAME}|' \ ${WRKSRC}/configure.in \ ${WRKSRC}/doc/Makefile.am .else @${REINPLACE_CMD} -e 's| doc | |' \ ${WRKSRC}/Makefile.am .endif post-install: ${MKDIR} -m 0750 ${STAGEDIR}/var/run/heartbeat/pengine ${MKDIR} ${STAGEDIR}/var/lib/heartbeat/mgmt ${TOUCH} ${STAGEDIR}/var/run/heartbeat.pid .if ${PORT_OPTIONS:MDOCS} # Install sample configuration ${CP} -p ${STAGEDIR}${DOCSDIR}/authkeys ${STAGEDIR}${PREFIX}/etc/ha.d/authkeys.sample ${CP} -p ${STAGEDIR}${DOCSDIR}/ha.cf ${STAGEDIR}${PREFIX}/etc/ha.d/ha.cf.sample ${CP} -p ${STAGEDIR}${DOCSDIR}/logd.cf ${STAGEDIR}${PREFIX}/etc/ha.d/logd.cf.sample .endif .if ${PORT_OPTIONS:MLDIRECTORD} ${CP} -p ${WRKSRC}/ldirectord/ldirectord.cf ${STAGEDIR}${PREFIX}/etc/ha.d/ldirectord.cf.sample .endif .include Index: head/sysutils/heartbeat/files/patch-resources-OCF-IPaddr =================================================================== --- head/sysutils/heartbeat/files/patch-resources-OCF-IPaddr (revision 392671) +++ head/sysutils/heartbeat/files/patch-resources-OCF-IPaddr (revision 392672) @@ -1,67 +1,67 @@ patch attached Patch attached with submission follows: --- resources/OCF/IPaddr.orig 2009-08-06 13:08:35.000000000 +0200 +++ resources/OCF/IPaddr 2009-08-06 13:12:35.000000000 +0200 @@ -298,9 +298,56 @@ return $OCF_ERR_GENERIC } +# +# Find out which alias serves the given IP address +# The argument is an IP address, and its output +# is an interface name (e.g., "em0"). +# +# parse the output of ifconfig and find the interface +# that holds ip address $ip (multiple may exist, but +# only one with flag UP) +# Try to find an interface with flag UP. If we don't find +# such an interface, try to find one with flag DOWN + find_interface_bsd() { - #$IFCONFIG $IFCONFIG_A_OPT | grep "inet.*[: ]$OCF_RESKEY_ip " - $IFCONFIG | grep "$ipaddr" -B20 | grep "UP," | tail -n 1 | cut -d ":" -f 1 + + ipaddr="$1"; + + /sbin/ifconfig \ -+ | /usr/bin/perl -w -e ' ++ | %%LOCALBASE%%/bin/perl -w -e ' + + my $ip = $ARGV[0]; + + if (! $ip) { + exit(255); + } + + my $if_name = ""; + my $if_status = 0; + + my $down_if_name = ""; + + while () { + chomp(); + if ( /^(\w+):\sflags=/ ) { + $if_name = $1; + $if_status = ( /UP/ ) ? 1 : 0; + } + if ( /^\tinet\s${ip}\s/ ) { + if ( $if_status ) { + print $if_name; + exit(0) + } else { + $down_if_name = $if_name; + } + } + } + + if ($down_if_name) { + print $down_if_name; + } + + ' $ipaddr } #