sys-cluster/drbd-utils: new ebuild fix #513928 thx to Benjamin Beier Jerry McDonald Mark (voidzero) Mike Williams Zentoo

Package-Manager: portage-2.2.20.1
This commit is contained in:
Ultrabug
2015-09-17 15:43:42 +02:00
parent d29fa37c39
commit 080e72c050
5 changed files with 282 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST drbd-utils-8.9.3.tar.gz 768700 SHA256 011050578c153bf4fef86e03749304ff9f333b7af3512c5c395e0e870a0445bd SHA512 1b1cb3d1eb7f14f693e8a73b9864257e439e443ce685084c3864da4340113f18355d1e447177956ee0d8edcee35e771442b9f85b89ec5a6eb0ad717738461ca2 WHIRLPOOL f21aec707f06d361ae336d0cf1e55fa546e5f250f869c80829f806eaef7d59c12ff30d1ded39e3624b162a9bff1ffe96cb3cb1acd85ca58ca29a4998740fba85

View File

@@ -0,0 +1,95 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
inherit bash-completion-r1 eutils multilib udev versionator
LICENSE="GPL-2"
DESCRIPTION="mirror/replicate block-devices across a network-connection"
SRC_URI="http://oss.linbit.com/drbd/${P/_/}.tar.gz"
HOMEPAGE="http://www.drbd.org"
KEYWORDS="~amd64 ~x86"
IUSE="heartbeat pacemaker +udev xen"
SLOT="0"
DEPEND="heartbeat? ( sys-cluster/heartbeat )
pacemaker? ( sys-cluster/pacemaker )
udev? ( virtual/udev )
!!sys-cluster/drbd"
RDEPEND="${DEPEND}"
S="${WORKDIR}/${P/_/}"
src_prepare() {
# respect LDFLAGS, #453442
sed -e "s/\$(CC) -o/\$(CC) \$(LDFLAGS) -o/" \
-e "/\$(DESTDIR)\$(localstatedir)\/lock/d" \
-i user/*/Makefile.in || die
# respect multilib
sed -i -e "s:/lib/:/$(get_libdir)/:g" \
Makefile.in scripts/{Makefile.in,global_common.conf,drbd.conf.example} || die
sed -e "s:@prefix@/lib:@prefix@/$(get_libdir):" \
-e "s:(DESTDIR)/lib:(DESTDIR)/$(get_libdir):" \
-i user/*/Makefile.in || die
# correct install paths (really correct this time)
sed -i -e "s:\$(sysconfdir)/bash_completion.d:$(get_bashcompdir):" \
scripts/Makefile.in || die
# don't participate in user survey bug 360483
sed -i -e '/usage-count/ s/yes/no/' scripts/global_common.conf || die
sed -i -e "s:\$(sysconfdir)/udev:$(get_udevdir):" scripts/Makefile.in || die
epatch "${FILESDIR}"/run-lock.patch
autoreconf
}
src_configure() {
econf \
--localstatedir=/var \
--without-rgmanager \
$(use_with udev) \
$(use_with xen) \
$(use_with pacemaker) \
$(use_with heartbeat) \
--with-bashcompletion \
--with-distro=gentoo
}
src_compile() {
# only compile the tools
emake OPTFLAGS="${CFLAGS}" tools
}
src_install() {
# only install the tools
emake DESTDIR="${D}" install-tools
dodoc README ChangeLog
# install our own init script
newinitd "${FILESDIR}"/${PN}-8.0.rc ${PN/-utils/}
dodoc scripts/drbd.conf.example
dosym /usr/sbin/drbdadm /sbin/drbdadm
}
pkg_postinst() {
einfo
einfo "Please copy and gunzip the configuration file:"
einfo "from /usr/share/doc/${PF}/${PN}.conf.example.bz2 to /etc/${PN/-utils/}.conf"
einfo "and edit it to your needs. Helpful commands:"
einfo "man 5 drbd.conf"
einfo "man 8 drbdsetup"
einfo "man 8 drbdadm"
einfo "man 8 drbddisk"
einfo "man 8 drbdmeta"
einfo
elog "Remember to enable drbd support in kernel."
}

View File

@@ -0,0 +1,159 @@
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Id$
extra_started_commands="reload"
depend() {
use logger
need net
before heartbeat
after sshd
}
DEFAULTFILE="/etc/conf.d/drbd"
DRBDADM="/sbin/drbdadm"
PROC_DRBD="/proc/drbd"
MODPROBE="/sbin/modprobe"
RMMOD="/sbin/rmmod"
UDEV_TIMEOUT=10
ADD_MOD_PARAM=""
PATH=${PATH}:/lib/drbd:/lib64/drbd
if [ -f $DEFAULTFILE ]; then
. $DEFAULTFILE
fi
# Just in case drbdadm want to display any errors in the configuration
# file, or we need to ask the user about registering this installation
# at http://usage.drbd.org, we call drbdadm here without any IO
# redirection.
$DRBDADM sh-nop
assure_module_is_loaded() {
[ -e "$PROC_DRBD" ] && return
ebegin "Loading drbd module"
ret=0
$MODPROBE -s drbd `$DRBDADM sh-mod-parms` $ADD_MOD_PARAM || ret=20
eend $ret
return $ret
}
adjust_with_progress() {
IFS_O=$IFS
NEWLINE='
'
IFS=$NEWLINE
local D=0
local S=0
local N=0
einfon "Setting drbd parameters "
COMMANDS=`$DRBDADM -d adjust all` || {
eend 20 "Error executing drbdadm"
return 20
}
echo -n "[ "
for CMD in $COMMANDS; do
if echo $CMD | grep -q disk; then echo -n "d$D "; D=$(( D+1 ));
elif echo $CMD | grep -q syncer; then echo -n "s$S "; S=$(( S+1 ));
elif echo $CMD | grep -q net; then echo -n "n$N "; N=$(( N+1 ));
else echo -n ".. ";
fi
IFS=$IFS_O
$CMD || {
echo
eend 20 "cmd $CMD failed!"
return 20
}
IFS=$NEWLINE
done
echo "]"
eend 0
IFS=$IFS_O
}
start() {
einfo "Starting DRBD resources:"
eindent
assure_module_is_loaded || return $?
adjust_with_progress || return $?
# make sure udev has time to create the device files
ebegin "Waiting for udev device creation ..."
for RESOURCE in `$DRBDADM sh-resources`; do
for DEVICE in `$DRBDADM sh-dev $RESOURCE`; do
UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt 0 ] ; do
sleep 1
UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
done
done
done
eend 0
einfon "Waiting for connection "
$DRBDADM wait-con-int
ret=$?
echo
sleep 5
einfon "Become primary if configured "
$DRBDADM sh-b-pri all
echo
eend $ret
return $ret
}
stop() {
ebegin "Stopping all DRBD resources"
# Check for mounted drbd devices
if ! grep -q '^/dev/drbd' /proc/mounts &>/dev/null; then
if [ -e ${PROC_DRBD} ]; then
${DRBDADM} down all
ret=$?
sleep 3
if [ -e /proc/modules ] && grep -q '^drbd' /proc/modules ; then
${RMMOD} drbd
fi
fi
eend $ret
return $ret
else
einfo "drbd devices mounted, please umount them before trying to stop drbd!"
eend 1
return 1
fi
}
status() {
# NEEDS to be heartbeat friendly...
# so: put some "OK" in the output.
if [ -e $PROC_DRBD ]; then
ret=0
ebegin "drbd driver loaded OK; device status:"
eend $ret
cat $PROC_DRBD
else
ebegin "drbd not loaded"
ret=3
eend $ret
fi
return $ret
}
reload() {
ebegin "Reloading DRBD"
${DRBDADM} adjust all
ret=$?
eend $ret
return $ret
}

View File

@@ -0,0 +1,13 @@
--- configure.ac.orig 2015-01-31 23:19:18.745021931 +0000
+++ configure.ac 2015-01-31 23:19:38.988027506 +0000
@@ -353,8 +353,8 @@
AH_TEMPLATE(DRBD_LEGACY_84, [Include support for drbd-8.4 kernel code])
AC_SUBST(DRBD_LIB_DIR, [$localstatedir/lib/$PACKAGE_TARNAME])
-AC_SUBST(DRBD_RUN_DIR, [$localstatedir/run/$PACKAGE_TARNAME])
-AC_SUBST(DRBD_LOCK_DIR, [$localstatedir/lock])
+AC_SUBST(DRBD_RUN_DIR, [/run/$PACKAGE_TARNAME])
+AC_SUBST(DRBD_LOCK_DIR, [/run/lock])
AC_SUBST(DRBD_CONFIG_DIR, [$sysconfdir])
AC_DEFINE_UNQUOTED(DRBD_LIB_DIR, ["$DRBD_LIB_DIR"])

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>cluster</herd>
<use>
<flag name='xen'>Enable Xen integration</flag>
<flag name='pacemaker'>Enable Pacemaker integration</flag>
<flag name='heartbeat'>Enable Heartbeat integration</flag>
</use>
<longdescription>
The user space tools to control, configure the DRBD driver, as well as integration programs and scripts
that glues the DRBD system to cluster management software and other system components.
</longdescription>
</pkgmetadata>