# 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 }