summaryrefslogtreecommitdiff
path: root/community-testing
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-08-23 00:03:08 +0000
committerroot <root@rshg054.dnsready.net>2012-08-23 00:03:08 +0000
commitc40883520f917311c212dc4a22e86be30cef658f (patch)
treeef8badd68c32564574e9b9317db1884fdaf98d2f /community-testing
parent297a042ac9a7bbd2b18a9551f5fa4fe43faf53b2 (diff)
Thu Aug 23 00:03:08 UTC 2012
Diffstat (limited to 'community-testing')
-rw-r--r--community-testing/drbd/01-remove-old-sanity-check.diff24
-rw-r--r--community-testing/drbd/PKGBUILD67
-rw-r--r--community-testing/drbd/drbd.rc58
-rw-r--r--community-testing/drbd/drbd.service19
4 files changed, 168 insertions, 0 deletions
diff --git a/community-testing/drbd/01-remove-old-sanity-check.diff b/community-testing/drbd/01-remove-old-sanity-check.diff
new file mode 100644
index 000000000..04edb7571
--- /dev/null
+++ b/community-testing/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-testing/drbd/PKGBUILD b/community-testing/drbd/PKGBUILD
new file mode 100644
index 000000000..5afc6db41
--- /dev/null
+++ b/community-testing/drbd/PKGBUILD
@@ -0,0 +1,67 @@
+# $Id: PKGBUILD 75398 2012-08-21 20:52:40Z seblu $
+# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
+
+pkgname=drbd
+pkgver=8.3.13
+pkgrel=1
+arch=('i686' 'x86_64')
+pkgdesc='Userland tools for Distributed Replicated Block Device'
+url='http://www.drbd.org'
+license=('GPL2')
+depends=('perl' 'bash')
+source=("http://oss.linbit.com/drbd/8.3/$pkgname-$pkgver.tar.gz"
+ "$pkgname.rc"
+ "$pkgname.service")
+backup=('etc/drbd.conf' 'etc/drbd.d/global_common.conf')
+md5sums=('760a25459ef6b7262a2a3572c1561c5b'
+ '8902a2f7aca6245c27e9566a1509312c'
+ 'afbb345094db49b0a474c0b4e51c0acd')
+
+build() {
+ cd $pkgname-$pkgver
+ ./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 forced /sbin binaries
+ cd "$pkgdir"
+ mv sbin/* usr/sbin
+ rmdir sbin
+ # fix hardcoded path in udev rules
+ sed -i 's,/sbin/drbdadm,/usr/sbin/drbdadm,' etc/udev/rules.d/65-drbd.rules
+ # move udev files
+ mv etc/udev usr/lib
+ # move bash completion
+ install -dm 755 usr/share/bash-completion
+ mv etc/bash_completion.d usr/share/bash-completion/completions
+ # remove /var/lock
+ rmdir var/lock
+ # autoload module
+ install -Dm 644 /dev/null usr/lib/modules-load.d/$pkgname.conf
+ echo 'drbd' > usr/lib/modules-load.d/$pkgname.conf
+ # setup initscript (replace)
+ cd "$srcdir"
+ install -Dm 755 $pkgname.rc "$pkgdir/etc/rc.d/$pkgname"
+ # install systemd stuff
+ install -Dm 644 $pkgname.service \
+ "$pkgdir/usr/lib/systemd/system/$pkgname.service"
+}
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/community-testing/drbd/drbd.rc b/community-testing/drbd/drbd.rc
new file mode 100644
index 000000000..b8b196e4b
--- /dev/null
+++ b/community-testing/drbd/drbd.rc
@@ -0,0 +1,58 @@
+#!/bin/bash
+# Written by Sébastien Luttringer
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DRBDADM='/usr/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:
diff --git a/community-testing/drbd/drbd.service b/community-testing/drbd/drbd.service
new file mode 100644
index 000000000..ddd6c62b7
--- /dev/null
+++ b/community-testing/drbd/drbd.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Distributed Replicated Block Device
+After=systemd-modules-load.service network.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+
+# load config
+ExecStart=/usr/sbin/drbdadm adjust all
+# user interruptible version of wait-connect all
+ExecStart=/usr/sbin/drbdadm wait-con-int
+# become primary if configured
+ExecStart=/usr/sbin/drbdadm sh-b-pri all
+# disconnect and detach all resources
+ExecStop=/usr/sbin/drbdadm down all
+
+[Install]
+WantedBy=multi-user.target