summaryrefslogtreecommitdiff
path: root/community/drbd
diff options
context:
space:
mode:
Diffstat (limited to 'community/drbd')
-rw-r--r--community/drbd/01-remove-old-sanity-check.diff24
-rw-r--r--community/drbd/PKGBUILD56
-rw-r--r--community/drbd/drbd.rc58
3 files changed, 138 insertions, 0 deletions
diff --git a/community/drbd/01-remove-old-sanity-check.diff b/community/drbd/01-remove-old-sanity-check.diff
new file mode 100644
index 000000000..04edb7571
--- /dev/null
+++ b/community/drbd/01-remove-old-sanity-check.diff
@@ -0,0 +1,24 @@
+From: Lars Ellenberg <lars.ellenberg@linbit.com>
+Date: Thu, 3 Nov 2011 09:40:43 +0000 (+0100)
+Subject: build: remove old sanity check to allow build against linux 3.1
+X-Git-Url: http://git.drbd.org/gitweb.cgi?p=drbd-8.3.git;a=commitdiff_plain;h=790c26b09519b9e02b3a7cf7897fb17c2ae339bf
+
+build: remove old sanity check to allow build against linux 3.1
+---
+
+diff --git a/drbd/Makefile b/drbd/Makefile
+index 0985340..7a09603 100644
+--- a/drbd/Makefile
++++ b/drbd/Makefile
+@@ -90,11 +90,6 @@ else
+ endif
+ endif
+
+- KDIR_Makefile_PATCHLEVEL = $(shell test -e $(KDIR)/Makefile && grep "^PATCHLEVEL = " $(KDIR)/Makefile | cut -d " " -f 3)
+- ifneq ($(findstring $(KDIR_Makefile_PATCHLEVEL),12345),)
+- $(error "won't compile with this kernel version")
+- endif
+-
+ .PHONY: drbd.o default all greeting clean kbuild install dep tags
+
+ drbd.o: greeting kbuild
diff --git a/community/drbd/PKGBUILD b/community/drbd/PKGBUILD
new file mode 100644
index 000000000..68d7dea8a
--- /dev/null
+++ b/community/drbd/PKGBUILD
@@ -0,0 +1,56 @@
+# $Id: PKGBUILD 63408 2012-02-02 10:00:55Z seblu $
+# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
+
+pkgname=drbd
+pkgver=8.3.11
+pkgrel=1
+arch=('i686' 'x86_64')
+pkgdesc='Userland tools for drbd block devices'
+url='http://www.drbd.org'
+license=('GPL2')
+source=("http://oss.linbit.com/drbd/8.3/$pkgname-$pkgver.tar.gz"
+ "$pkgname.rc"
+ '01-remove-old-sanity-check.diff')
+backup=('etc/drbd.conf' 'etc/drbd.d/global_common.conf')
+md5sums=('e47a35a80143b72e9708844efbe2e608'
+ '19236c6fe7a8c9191d67a4df15892b78'
+ '24144d23b31f9ce66929fe989247c779')
+
+build() {
+ cd $pkgname-$pkgver
+ # patch bad sanity check in makefile
+ patch -p1 -i ../01-remove-old-sanity-check.diff
+ ./configure \
+ --prefix=/usr \
+ --localstatedir=/var \
+ --sysconfdir=/etc \
+ --with-distro=generic \
+ --with-utils \
+ --with-bashcompletion \
+ --with-udev \
+ --without-km \
+ --without-rgmanager \
+ --without-pacemaker \
+ --without-heartbeat \
+ --without-xen \
+ --with-initdir=/etc/rc.d
+ #--with-legacy_utils \
+ make
+}
+
+package() {
+ cd $pkgname-$pkgver
+ make DESTDIR="$pkgdir" install
+
+ # move udev files to the right place
+ install -d -m 755 "$pkgdir/lib"
+ mv "$pkgdir/etc/udev" "$pkgdir/lib"
+
+ # remove /var/lock
+ rmdir "$pkgdir/var/lock"
+
+ # replace
+ install -D -m 755 "$srcdir/$pkgname.rc" "$pkgdir/etc/rc.d/$pkgname"
+}
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/community/drbd/drbd.rc b/community/drbd/drbd.rc
new file mode 100644
index 000000000..7aca1f394
--- /dev/null
+++ b/community/drbd/drbd.rc
@@ -0,0 +1,58 @@
+#!/bin/bash
+# Written by Sébastien Luttringer
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DRBDADM='/sbin/drbdadm'
+PROC_DRBD='/proc/drbd'
+
+check_config() {
+ # check if module is loaded
+ if [[ ! -e $PROC_DRBD ]]; then
+ echo "Missing $PROC_DRBD. Try to load drbd module!"
+ stat_fail
+ exit 1
+ fi
+ # check if config is correct
+ if ! $DRBDADM dump &>/dev/null; then
+ echo 'Invalid configuration'
+ stat_fail
+ exit 1
+ fi
+}
+
+case "$1" in
+ start)
+ stat_busy 'Starting DRBD resources'
+ # check module and config
+ check_config
+ # load config
+ $DRBDADM adjust all 2>/dev/null || { stat_fail; exit 1; }
+ # User interruptible version of wait-connect all
+ $DRBDADM wait-con-int 2>/dev/null || { stat_fail; exit 1; }
+ # Become primary if configured
+ $DRBDADM sh-b-pri all 2>/dev/nul l|| { stat_fail; exit 1; }
+ add_daemon drbd
+ stat_done
+ ;;
+ stop)
+ stat_busy 'Stopping DRBD resources'
+ # check module and config
+ check_config
+ # disconnect and detach all resources
+ $DRBDADM down all 2>/dev/null || { stat_fail; exit 1; }
+ rm_daemon drbd
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+exit 0
+
+# vim:set ts=2 sw=2 ft=sh et: