aboutsummaryrefslogtreecommitdiffstats
path: root/main/drbd-utils
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-12-04 14:28:48 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-12-04 14:48:46 +0000
commit081d2dc8bbc688ccdb71d6a5a62e246e441514e6 (patch)
treef2b3fe8f05ccff03ab346ee5decd1e40a7f88966 /main/drbd-utils
parent4c104d6a68eeec04fdc3c12a8611df104139d0d3 (diff)
downloadaports-081d2dc8bbc688ccdb71d6a5a62e246e441514e6.tar.bz2
aports-081d2dc8bbc688ccdb71d6a5a62e246e441514e6.tar.xz
main/drbd-utils: rename from drbd and upgrade to 8.9.4
fixes #4920
Diffstat (limited to 'main/drbd-utils')
-rw-r--r--main/drbd-utils/APKBUILD76
-rw-r--r--main/drbd-utils/bits_per_long.patch22
-rw-r--r--main/drbd-utils/busybox-mv.patch13
-rw-r--r--main/drbd-utils/drbd.initd158
4 files changed, 269 insertions, 0 deletions
diff --git a/main/drbd-utils/APKBUILD b/main/drbd-utils/APKBUILD
new file mode 100644
index 0000000000..252b159e2e
--- /dev/null
+++ b/main/drbd-utils/APKBUILD
@@ -0,0 +1,76 @@
+# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=drbd-utils
+pkgver=8.9.4
+pkgrel=0
+pkgdesc="Network-based RAID 1"
+url="http://www.drbd.org"
+arch="all"
+license="GPL"
+depends="bash"
+depends_dev="bash bison flex"
+makedepends="$depends_dev linux-headers libxslt"
+install=
+provides="drbd"
+subpackages="$pkgname-doc $pkgname-pacemaker"
+source="http://oss.linbit.com/drbd/drbd-utils-$pkgver.tar.gz
+ busybox-mv.patch
+ bits_per_long.patch
+ drbd.initd"
+
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr \
+ --sbindir=/sbin \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --with-pacemaker \
+ --without-udev \
+ --without-heartbeat \
+ --without-rgmanager \
+ --without-xen \
+ --without-bashcompletion
+
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install
+ install -m755 -D "$srcdir/drbd.initd" \
+ "$pkgdir/etc/init.d/drbd" || return 1
+}
+
+pacemaker() {
+ arch="noarch"
+ depends="drbd"
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/ocf "$subpkgdir"/usr/lib
+}
+
+md5sums="8671f86d366288ea082ac1b4571eaa4d drbd-utils-8.9.4.tar.gz
+9bc7ecc7e6b336782f6a09c3366bf590 busybox-mv.patch
+504756f76c96c02439d39d73c6965cb5 bits_per_long.patch
+37a3e196fab9b4f568f79b3bfdee3081 drbd.initd"
+sha256sums="38929279d1bf549fd1ade4ce6773a6fe209db51bbb0efe7bf6d2b7871ba0afbc drbd-utils-8.9.4.tar.gz
+ea7e76b4deb327c13b2efce7ed3b5a03440de3c721eb0565fd64bf99d34e6b24 busybox-mv.patch
+f6864221863adb6398f1278c0139dfaad05d9a049740b691c85a520c1b0cd10e bits_per_long.patch
+9ea7427be45fc184cb4a74b6a7b0d688859d38c7a35a96c6c586dedaf4ce30df drbd.initd"
+sha512sums="4a662921d8c823f3dfce5d0bfb58441231441929fd70447aad9b40f1d84aa9b82a93d034ef6db34b352902519042218000338927a1dfec46953bdb602d205a3b drbd-utils-8.9.4.tar.gz
+22da5e241a6e33868ad91edb44ca51381a05909151a2e3f945efff1568903d415b77689231a6df5ff9c1e4b095d6a8bb82fc725336d65fb191036c7e97b2e3bb busybox-mv.patch
+6d54d89c3f85ae8b1e49e05a6fcc7d88bd504c8e2614923c282c48bd6fa6fcbf704ee5c51d3ea809ba9cc5e1cc377da55ffe68d065a27f68e7ee15b6fe7d9d37 bits_per_long.patch
+bb465e32273aaba0b86ae681bc94c58bb51f542221f51ced197e22b316ce1bc9a0b4fe1f43af07ef13b3f0946466a43218f0a2ab7f4210adbb00174a503b64d7 drbd.initd"
diff --git a/main/drbd-utils/bits_per_long.patch b/main/drbd-utils/bits_per_long.patch
new file mode 100644
index 0000000000..f6b580eedb
--- /dev/null
+++ b/main/drbd-utils/bits_per_long.patch
@@ -0,0 +1,22 @@
+diff --git a/user/shared/drbd_endian.h b/user/shared/drbd_endian.h
+index 69f7145..515c942 100644
+--- a/user/shared/drbd_endian.h
++++ b/user/shared/drbd_endian.h
+@@ -13,12 +13,17 @@
+
+ #include <stdint.h>
+ #include <endian.h>
++#include <limits.h>
+
+ #ifndef BITS_PER_LONG
+ # if defined(__SIZEOF_LONG__)
+ # define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
+ # elif defined(__WORDSIZE)
+ # define BITS_PER_LONG __WORDSIZE
++# elif ULONG_MAX == 0xffffffffffffffff
++# define BITS_PER_LONG 64
++# elif ULONG_MAX == 0xffffffff
++# define BITS_PER_LONG 32
+ # else /* wtf is wrong with your libc headers? */
+ # error "neither BITS_PER_LONG, __SIZEOF_LONG__, nor __WORDSIZE defined"
+ # endif
diff --git a/main/drbd-utils/busybox-mv.patch b/main/drbd-utils/busybox-mv.patch
new file mode 100644
index 0000000000..74fc9faa1c
--- /dev/null
+++ b/main/drbd-utils/busybox-mv.patch
@@ -0,0 +1,13 @@
+diff --git a/user/shared/Makefile.in b/user/shared/Makefile.in
+index 8b8be16..3240089 100644
+--- a/user/shared/Makefile.in
++++ b/user/shared/Makefile.in
+@@ -84,7 +84,7 @@ drbd_buildtag.c:
+ grep return $@ ; \
+ fi ; \
+ echo -e "\t\t\" build by $$USER@$$HOSTNAME, `date "+%F %T"`\";\n}"; \
+- mv --force $@.new $@
++ mv -f $@.new $@
+
+ drbdmeta_scanner.c: drbdmeta_scanner.fl drbdmeta_parser.h
+ flex -s -odrbdmeta_scanner.c drbdmeta_scanner.fl
diff --git a/main/drbd-utils/drbd.initd b/main/drbd-utils/drbd.initd
new file mode 100644
index 0000000000..0126e156d3
--- /dev/null
+++ b/main/drbd-utils/drbd.initd
@@ -0,0 +1,158 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/drbd/files/drbd-8.0.rc,v 1.8 2013/01/17 19:09:04 robbat2 Exp $
+
+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=""
+
+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
+}