- Proper FreeBSD startup script is now available.

- Building with NOPORTDOCS succeeds.
- Added drac3 and apcmastersnmp stonith plugin install options.
- Workaround for vacm, bladehpi, and ipmilan stonith plugin auto-building.
- Added further information on v1 => v2 upgrade to pkg-message.
- Added MAKE_JOBS_SAFE as the port can be parallel built.
- Bumped PORTREVISION

PR:		ports/139132
Submitted by:	Justin Head <ports@encarnate.com>
This commit is contained in:
Greg Larkin 2009-12-16 03:40:26 +00:00
parent 21d657db3a
commit e93cee1e6a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=245958
7 changed files with 314 additions and 45 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= heartbeat
PORTVERSION= 2.1.4
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= sysutils
#MASTER_SITES= http://hg.linux-ha.org/lha-2.1/archive/STABLE-2.1.4.tar.bz2
MASTER_SITES= ${MASTER_SITE_LOCAL}
@ -57,12 +57,16 @@ SUB_LIST= BATCH=${BATCH}
PKGDEINSTALL= ${PKGINSTALL}
MAKE_JOBS_SAFE= yes
MAN1= cl_status.1 ha_logger.1 hb_addnode.1 hb_delnode.1 hb_standby.1 hb_takeover.1
MAN8= apphbd.8 cibadmin.8 crm_resource.8 ha_logd.8 heartbeat.8 \
meatclient.8 stonith.8
OPTIONS= MGMT "Enable X11 Management Utilities" Off \
LDIRECTORD "Enable Linux Director Daemon" Off
LDIRECTORD "Enable Linux Director Daemon" Off \
APCSNMP "Enable APC SNMP Stonith Device" Off \
DRAC3 "Enable Dell DRACIII Stonith Device" Off
.include <bsd.port.pre.mk>
@ -91,8 +95,50 @@ CONFIGURE_ARGS+= --disable-ldirectord
PLIST_SUB+= LDIRECTORD="@comment "
.endif
.if defined(WITH_APCSNMP) || exists (${PREFIX}/lib/libnetsnmp.so)
LIB_DEPENDS+= netsnmp:${PORTSDIR}/net-mgmt/net-snmp
PLIST_SUB+= APCSNMP=""
.else
PLIST_SUB+= APCSNMP="@comment "
.endif
.if defined(WITH_DRAC3) || exists (${PREFIX}/lib/libcurl.so)
USE_CURL= yes
PLIST_SUB+= DRAC3=""
.else
PLIST_SUB+= DRAC3="@comment "
.endif
.if defined(NOPORTDOCS)
PLIST_SUB+= NOPORTDOCS="@comment "
.else
PLIST_SUB+= NOPORTDOCS=""
.endif
# BladeHPI Stonith Automagic Building
.if exists (${PREFIX}/include/openhpi/SaHpi.h)
PLIST_SUB+= HPI=""
.else
PLIST_SUB+= HPI="@comment "
.endif
# IPMI Lan Stonight Automagic Building
.if exists (${PREFIX}/include/ipmilan.h)
PLIST_SUB+= IPMI=""
.else
PLIST_SUB+= IPMI="@comment "
.endif
# VACM Stonith Automagic Building
.if exists (${PREFIX}/include/vacmclient_api.h)
PLIST_SUB+= VACM=""
.else
PLIST_SUB+= VACM="@comment "
.endif
pre-patch:
@${MV} ${WRKDIR}/Heartbeat-STABLE-2-1-${DISTNAME} ${WRKSRC}
@${CP} -f ${FILESDIR}/heartbeat.in ${WRKSRC}/heartbeat/init.d/
post-patch:
@${LN} -s ${WRKSRC}/include/config.h ${WRKSRC}/config.h
@ -107,7 +153,10 @@ post-patch:
${TAR} -cf libltdl.tar libltdl && \
${RM} -rf libltdl
.if !defined(NOPORTDOCS)
.if defined(NOPORTDOCS)
@${REINPLACE_CMD} -e 's| doc | |' \
${WRKSRC}/Makefile.am
.else
@${REINPLACE_CMD} -e 's|^\(docdir.*doc/\).*|\1${PORTNAME}|' \
${WRKSRC}/configure.in \
${WRKSRC}/doc/Makefile.am
@ -117,6 +166,10 @@ pre-install:
@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
.if !defined(NOPORTDOCS)
# Install sample configuration
@if [ ! -f ${PREFIX}/etc/ha.d/authkeys ]; then \
${CP} -p ${DOCSDIR}/authkeys ${PREFIX}/etc/ha.d/authkeys ; \
fi
@ -132,6 +185,7 @@ post-install:
${CP} -p ${DOCSDIR}/logd.cf ${PREFIX}/etc/ha.d/logd.cf ; \
fi
${CP} -p ${DOCSDIR}/logd.cf ${PREFIX}/etc/ha.d/logd.cf.sample
.endif
.if defined(WITH_LDIRECTORD)
@if [ ! -f ${PREFIX}/etc/ha.d/ldirectord.cf ]; then \
@ -144,6 +198,9 @@ post-install:
# those man pages manually if NOPORTDOCS is defined.
.if defined(NOPORTDOCS)
# Some subdirs treat man as documentation, therefor we have to install
# those man pages manually if NOPORTDOCS is defined.
.for f in ${MAN1}
${INSTALL_MAN} ${WRKSRC}/doc/${f} ${MANPREFIX}/man/man1
.endfor

View file

@ -0,0 +1,211 @@
#!/bin/sh
#
# PROVIDE: heartbeat
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable heartbeat:
#
# heartbeat_enable="YES" Set to NO by default.
# Set to YES to enable heartbeat.
# heartbeat_gracefulstop="YES" Set to NO by default.
# Set to YES to enable more graceful resource
# stopping behaviour at shutdown.
# Includes
. /etc/rc.subr
HA_DIR=@sysconfdir@/ha.d; export HA_DIR
. $HA_DIR/shellfuncs
LOCKDIR=@localstatedir@/lock/subsys
SUBSYS=heartbeat
RUNDIR=@localstatedir@/run
name="heartbeat"
rcvar=`set_rcvar`
load_rc_config $name
: ${heartbeat_enable="NO"}
: ${heartbeat_gracefulstop="NO"}
start_cmd="${name}_start"
stop_cmd="${name}_stop"
reload_cmd="${name}_reload"
restart_cmd="${name}_restart"
gracefulstop_cmd="${name}_gracefulstop"
command="$HA_BIN/heartbeat"
pidfile="$RUNDIR/heartbeat.pid"
required_files="$HA_DIR/ha.cf"
if checkyesno heartbeat_gracefulstop; then
stop_cmd="${gracefulstop_cmd}"
fi
heartbeat_checkyesno() {
case `ha_parameter $1 | tr '[A-Z]' '[a-z]'` in
y|yes|enable|on|true|1|manual) true;;
*) false;;
esac
}
heartbeat_gracefulstop() {
# Run cluster pre-stop
heartbeat_runstartstop pre-stop
# Stop heartbeat daemon
$HA_BIN/heartbeat -k >/dev/null 2>&1
RC=$?
sleeptime=$((`ha_parameter deadtime` + 10))
echo -n "Sleeping $sleeptime seconds to allow complete resource takeover: "
sleep $sleeptime
echo "OK"
# ???
if [ $RC -eq 0 ]; then
rm -f $LOCKDIR/$SUBSYS
fi
# Run cluster post-stop
heartbeat_runstartstop post-stop $RC
# Stop Logd
logd_stop
return $RC
}
heartbeat_reload() {
# Re-reads configuration files. Will *keep* it's resources.
$HA_BIN/heartbeat -r >/dev/null 2>&1
}
heartbeat_restart() {
sleeptime=$((`ha_parameter deadtime` + 10))
if `heartbeat_stop`; then
echo -n "Sleeping $sleeptime seconds to allow complete resource takeover: "
sleep $sleeptime
echo "OK"
echo ""
echo "Starting heartbeat."
heartbeat_start
else
echo "Heartbeat did not stop correctly."
exit 1
fi
}
heartbeat_runstartstop() {
# Run custom cluster commands before/after operations
if [ -f $HA_RESOURCEDIR/startstop ]; then
$HA_RESOURCEDIR/startstop "$@"
fi
}
heartbeat_start() {
# Start Logd
logd_start
# Run cluster pre-startup
heartbeat_runstartstop pre-start
# Check if CRM enabled
if ! `heartbeat_checkyesno crm`; then
# Heartbeat v1 configuration
$HA_NOARCHBIN/ResourceManager verifyallidle
fi
# ???
rm -f $RUNDIR/ppp.d/*
if [ ! -d $RUNDIR/heartbeat ]; then
mkdir -p $RUNDIR/heartbeat/ccm
mkdir -p $RUNDIR/heartbeat/crm
chown -R @HA_CCMUSER@:@HA_APIGROUP@ $RUNDIR/heartbeat
chmod -R 750 $RUNDIR/heartbeat
fi
# Heartbeat v1 configuration files
if [ -f $HA_DIR/ipresources -a ! -f $HA_DIR/haresources ]; then
mv $HA_DIR/ipresources $HA_DIR/haresources
fi
# Start heartbeat daemon
$HA_BIN/heartbeat > /dev/null 2>&1
RC=$?
# ???
if [ $RC -eq 0 ]; then
if [ ! -d $LOCKDIR ]; then
mkdir -p $LOCKDIR
fi
touch $LOCKDIR/$SUBSYS
fi
# Run cluster post-startup
heartbeat_runstartstop post-start $RC
return $RC
}
heartbeat_stop() {
# Run cluster pre-stop
heartbeat_runstartstop pre-stop
# Stop heartbeat daemon
$HA_BIN/heartbeat -k >/dev/null 2>&1
RC=$?
# ???
if [ $RC -eq 0 ]; then
rm -f $LOCKDIR/$SUBSYS
fi
# Run cluster post-stop
heartbeat_runstartstop post-stop $RC
# Stop Logd
logd_stop
return $RC
}
logd_start() {
# Check if enabled.
if `heartbeat_checkyesno use_logd`; then
# Check if running
if ! `$HA_BIN/ha_logd -s >/dev/null 2>&1`; then
# Start
if ! `$HA_BIN/ha_logd -d -c $HA_DIR/logd.cf >/dev/null 2>&1`; then
exit 1
fi
fi
fi
}
logd_stop() {
# Check if enabled.
if `heartbeat_checkyesno use_logd`; then
# Check if running
if `$HA_BIN/ha_logd -s >/dev/null 2>&1`; then
# Stop
$HA_BIN/ha_logd -k >/dev/null 2>&1
fi
fi
}
extra_commands="reload gracefulstop"
run_rc_command "$1"

View file

@ -0,0 +1,17 @@
--- doc/ha.cf.orig 2008-08-18 12:32:19.000000000 +0000
+++ doc/ha.cf 2009-12-13 00:16:02.245124213 +0000
@@ -13,6 +13,14 @@
#
# All will be fine if you keep them ordered as in this example.
#
+
+# Enable the Heartbeat v2 Cluster Resource Manager
+#
+# Don't forget to read how to configure v2 and heartbeat in general @
+# http://www.linux-ha.org/GettingStartedRevisedV2
+# http://www.linux-ha.org/ha.cf
+crm on
+
#
# Note on logging:
# If all of debugfile, logfile and logfacility are not defined,

View file

@ -1,39 +0,0 @@
--- heartbeat/init.d/heartbeat.in.orig 2008-08-18 07:32:19.000000000 -0500
+++ heartbeat/init.d/heartbeat.in 2008-10-16 02:49:27.000000000 -0500
@@ -45,6 +45,27 @@
### END INIT INFO
+# FreeBSD
+# PROVIDE: heartbeat
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable heartbeat:
+# heartbeat_enable="YES"
+
+. /etc/rc.subr
+name="heartbeat"
+rcvar='set_rcvar'
+load_rc_config $name
+: ${heartbeat_enable="NO"}
+
+if ! checkyesno "heartbeat_enable"; then
+ exit 0
+fi
+
+set `echo $1 | sed s/fast//`
+
+
HA_DIR=@sysconfdir@/ha.d; export HA_DIR
CONFIG=$HA_DIR/ha.cf
. $HA_DIR/shellfuncs
@@ -161,7 +182,7 @@
fi
- $HA_BIN/ha_logd -d >/dev/null 2>&1
+ $HA_BIN/ha_logd -d -c $HA_DIR/logd.cf >/dev/null 2>&1
if
[ $? -ne 0 ]
then

View file

@ -6,6 +6,7 @@ UID=275
GID=${UID}
BATCH=${BATCH:-%%BATCH%%}
PREFIX=${PREFIX:-%%PREFIX%%}
case $2 in
@ -81,9 +82,9 @@ DEINSTALL)
# Check for running processes
echo -n "Checking if heartbeat is running... "
if ps -axc | grep -q heartbeat; then
echo -n "FOUND "
killall heartbeat
echo "KILLED"
echo -n "FOUND. Stopping... "
${PREFIX}/etc/rc.d/heartbeat forcestop
echo "STOPPED"
else
echo "NO"
fi

View file

@ -7,6 +7,13 @@
## ##
# #
CONFIGURATION:
- Please read the below site for configuration
changes between version 1 and 2.
http://www.linux-ha.org/GettingStartedRevisedV2
INFORMATION:
- Configuration directory: %%PREFIX%%/etc/ha.d

View file

@ -429,21 +429,33 @@ lib/stonith/plugins/external/xen0-ha
lib/stonith/plugins/stonith2/apcmaster.a
lib/stonith/plugins/stonith2/apcmaster.la
lib/stonith/plugins/stonith2/apcmaster.so
%%APCSNMP%%lib/stonith/plugins/stonith2/apcmastersnmp.a
%%APCSNMP%%lib/stonith/plugins/stonith2/apcmastersnmp.la
%%APCSNMP%%lib/stonith/plugins/stonith2/apcmastersnmp.so
lib/stonith/plugins/stonith2/apcsmart.a
lib/stonith/plugins/stonith2/apcsmart.la
lib/stonith/plugins/stonith2/apcsmart.so
lib/stonith/plugins/stonith2/baytech.a
lib/stonith/plugins/stonith2/baytech.la
lib/stonith/plugins/stonith2/baytech.so
%%HPI%%lib/stonith/plugins/stonith2/bladehpi.a
%%HPI%%lib/stonith/plugins/stonith2/bladehpi.la
%%HPI%%lib/stonith/plugins/stonith2/bladehpi.so
lib/stonith/plugins/stonith2/cyclades.a
lib/stonith/plugins/stonith2/cyclades.la
lib/stonith/plugins/stonith2/cyclades.so
%%DRAC3%%lib/stonith/plugins/stonith2/drac3.a
%%DRAC3%%lib/stonith/plugins/stonith2/drac3.la
%%DRAC3%%lib/stonith/plugins/stonith2/drac3.so
lib/stonith/plugins/stonith2/external.a
lib/stonith/plugins/stonith2/external.la
lib/stonith/plugins/stonith2/external.so
lib/stonith/plugins/stonith2/ibmhmc.a
lib/stonith/plugins/stonith2/ibmhmc.la
lib/stonith/plugins/stonith2/ibmhmc.so
%%IPMI%%lib/stonith/plugins/stonith2/ipmilan.a
%%IPMI%%lib/stonith/plugins/stonith2/ipmilan.la
%%IPMI%%lib/stonith/plugins/stonith2/ipmilan.so
lib/stonith/plugins/stonith2/meatware.a
lib/stonith/plugins/stonith2/meatware.la
lib/stonith/plugins/stonith2/meatware.so
@ -466,6 +478,9 @@ lib/stonith/plugins/stonith2/ssh.so
lib/stonith/plugins/stonith2/suicide.a
lib/stonith/plugins/stonith2/suicide.la
lib/stonith/plugins/stonith2/suicide.so
%%VACM%%lib/stonith/plugins/stonith2/vacm.a
%%VACM%%lib/stonith/plugins/stonith2/vacm.la
%%VACM%%lib/stonith/plugins/stonith2/vacm.so
lib/stonith/plugins/stonith2/wti_nps.a
lib/stonith/plugins/stonith2/wti_nps.la
lib/stonith/plugins/stonith2/wti_nps.so