diff options
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/drbd')
-rw-r--r-- | nixpkgs/pkgs/os-specific/linux/drbd/default.nix | 44 | ||||
-rw-r--r-- | nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch | 15 |
2 files changed, 59 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/drbd/default.nix b/nixpkgs/pkgs/os-specific/linux/drbd/default.nix new file mode 100644 index 000000000000..0e35f45f042a --- /dev/null +++ b/nixpkgs/pkgs/os-specific/linux/drbd/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchurl, flex, systemd, perl }: + +stdenv.mkDerivation rec { + name = "drbd-8.4.4"; + + src = fetchurl { + url = "http://oss.linbit.com/drbd/8.4/${name}.tar.gz"; + sha256 = "1w4889h1ak7gy9w33kd4fgjlfpgmp6hzfya16p1pkc13bjf22mm0"; + }; + + patches = [ ./pass-force.patch ]; + + nativeBuildInputs = [ flex ]; + buildInputs = [ perl ]; + + configureFlags = [ + "--without-distro" + "--without-pacemaker" + "--localstatedir=/var" + "--sysconfdir=/etc" + ]; + + preConfigure = + '' + export PATH=${systemd}/sbin:$PATH + substituteInPlace user/Makefile.in \ + --replace /sbin '$(sbindir)' + substituteInPlace user/legacy/Makefile.in \ + --replace '$(DESTDIR)/lib/drbd' '$(DESTDIR)$(LIBDIR)' + substituteInPlace user/drbdadm_usage_cnt.c --replace /lib/drbd $out/lib/drbd + substituteInPlace scripts/drbd.rules --replace /usr/sbin/drbdadm $out/sbin/drbdadm + ''; + + makeFlags = "SHELL=${stdenv.shell}"; + + installFlags = "localstatedir=$(TMPDIR)/var sysconfdir=$(out)/etc INITDIR=$(out)/etc/init.d"; + + meta = with stdenv.lib; { + homepage = http://www.drbd.org/; + description = "Distributed Replicated Block Device, a distributed storage system for Linux"; + license = licenses.gpl2; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch b/nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch new file mode 100644 index 000000000000..8f0201100f72 --- /dev/null +++ b/nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch @@ -0,0 +1,15 @@ +Propagate the --force flag in the legacy drbdadm to drbdsetup. +Otherwise "drbdadm primary --force" won't work as expected (the kernel +will say "State change failed: Need access to UpToDate data"). + +diff -ru -x '*~' drbd-8.4.0-orig/user/legacy/drbdadm_main.c drbd-8.4.0/user/legacy/drbdadm_main.c +--- drbd-8.4.0-orig/user/legacy/drbdadm_main.c 2011-07-07 06:55:39.000000000 -0400 ++++ drbd-8.4.0/user/legacy/drbdadm_main.c 2011-11-02 14:51:04.000000000 -0400 +@@ -1547,6 +1547,7 @@ + for (i = 0; i < soi; i++) { + argv[NA(argc)] = setup_opts[i]; + } ++ if (force) argv[NA(argc)] = "--force"; + argv[NA(argc)] = 0; + + setenv("DRBD_RESOURCE", res->name, 1); |