git.iko.soy/typeable/nixpkgs
on master help sign in
btrbk: Init at 0.22.2
commitea30f868140c70fe4157d4d935efa1f3b84a93bb authorMoritz Ulrich <moritz@tarn-vedra.de> dateFri 18 Mar 2016, 14:50 (11 years ago) parentedac7f0
4 files changed+118
pkgs/tools/backup/btrbk/btrbk-Prefix-PATH-instead-of-resetting-it.patch+39 pkgs/tools/backup/btrbk/btrbk-mail-Use-btrbk-instead-of-unbound-variable-btr.patch+25 pkgs/tools/backup/btrbk/default.nix+52 pkgs/top-level/all-packages.nix+2
pkgs/tools/backup/btrbk/btrbk-Prefix-PATH-instead-of-resetting-it.patchnew file+39
@@ -0,0 +1,39 @@
1+From d5978c207f2b266165140dd21e9746ace5792daf Mon Sep 17 00:00:00 2001
2+From: Moritz Ulrich <moritz@tarn-vedra.de>
3+Date: Fri, 18 Mar 2016 14:01:22 +0100
4+Subject: [PATCH] btrbk: Prefix PATH instead of resetting it.
5+
6+Some distros don't even install use /usr/bin, /sbin, etc. (notably
7+NixOS). Instead, they use PATH to specify which programs are available
8+to a given executable.
9+
10+This patch changes the behavior or `btrbk` so it extends PATH with its
11+own search paths instead of resetting it. This allows users and distros
12+to specify their own custom location for `btrfs` via `PATH`.
13+---
14+ btrbk | 9 +++++----
15+ 1 file changed, 5 insertions(+), 4 deletions(-)
16+
17+diff --git a/btrbk b/btrbk
18+index ab15858..0b91cbe 100755
19+--- a/btrbk
20++++ b/btrbk
21+@@ -2464,10 +2464,11 @@ sub exit_status
22+
23+ MAIN:
24+ {
25+- # set PATH instead of using absolute "/sbin/btrfs" (for now), as
26+- # different distros (and even different versions of btrfs-progs)
27+- # install the "btrfs" executable to different locations.
28+- $ENV{PATH} = '/sbin:/bin:/usr/sbin:/usr/bin';
29++ # Prefix PATH with /sbin etc. instead of using absolute
30++ # "/sbin/btrfs" (for now), as different distros (and even different
31++ # versions of btrfs-progs) install the "btrfs" executable to
32++ # different locations.
33++ $ENV{PATH} .= '/sbin:/bin:/usr/sbin:/usr/bin';
34+
35+ Getopt::Long::Configure qw(gnu_getopt);
36+ $Data::Dumper::Sortkeys = 1;
37+--
38+2.7.3
39+
pkgs/tools/backup/btrbk/btrbk-mail-Use-btrbk-instead-of-unbound-variable-btr.patchnew file+25
@@ -0,0 +1,25 @@
1+From 8abe8a915aa2d0c79c4dbe00dc7d255c32b7b85d Mon Sep 17 00:00:00 2001
2+From: Moritz Ulrich <moritz@tarn-vedra.de>
3+Date: Fri, 18 Mar 2016 13:20:48 +0100
4+Subject: [PATCH] btrbk-mail: Use `btrbk` instead of unbound variable `$btrbk`
5+
6+---
7+ contrib/cron/btrbk-mail | 2 +-
8+ 1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+diff --git a/contrib/cron/btrbk-mail b/contrib/cron/btrbk-mail
11+index f7e4f12..9143f2d 100755
12+--- a/contrib/cron/btrbk-mail
13++++ b/contrib/cron/btrbk-mail
14+@@ -113,7 +113,7 @@ case $exitcode in
15+ ;;
16+ 10) status="ERROR: At least one backup task aborted!"
17+ ;;
18+- *) status="ERROR: $btrbk failed with error code $exitcode"
19++ *) status="ERROR: btrbk failed with error code $exitcode"
20+ ;;
21+ esac
22+
23+--
24+2.7.3
25+
pkgs/tools/backup/btrbk/default.nixnew file+52
@@ -0,0 +1,52 @@
1+{ stdenv, fetchurl, coreutils, bash, btrfs-progs, perl, perlPackages, makeWrapper }:
2+
3+stdenv.mkDerivation rec {
4+ name = "btrbk-${version}";
5+ version = "0.22.2";
6+
7+ src = fetchurl {
8+ url = "http://digint.ch/download/btrbk/releases/${name}.tar.xz";
9+ sha256 = "1gbgi0dp62wlw7y72pgxjs6byxkrk73g35kqxzw0gjf32r5i4sb8";
10+ };
11+
12+ patches = [
13+ # https://github.com/digint/btrbk/pull/74
14+ ./btrbk-Prefix-PATH-instead-of-resetting-it.patch
15+ # https://github.com/digint/btrbk/pull/73
16+ ./btrbk-mail-Use-btrbk-instead-of-unbound-variable-btr.patch
17+ ];
18+
19+ buildInputs = with perlPackages; [ makeWrapper perl DateCalc ];
20+
21+ preInstall = ''
22+ substituteInPlace Makefile \
23+ --replace "/usr" "$out" \
24+ --replace "/etc" "$out/etc"
25+
26+ # Tainted Mode disables PERL5LIB
27+ substituteInPlace btrbk --replace "perl -T" "perl"
28+
29+ # Fix btrbk-mail
30+ substituteInPlace contrib/cron/btrbk-mail \
31+ --replace "/bin/date" "${coreutils}/bin/date" \
32+ --replace "/bin/echo" "${coreutils}/bin/echo" \
33+ --replace '$btrbk' 'btrbk'
34+ '';
35+
36+ fixupPhase = ''
37+ patchShebangs $out/
38+
39+ wrapProgram $out/sbin/btrbk \
40+ --set PERL5LIB $PERL5LIB \
41+ --prefix PATH ':' "${btrfs-progs}/bin:${bash}/bin/"
42+ '';
43+
44+ meta = with stdenv.lib; {
45+ description = "A backup tool for btrfs subvolumes";
46+ homepage = http://digint.ch/btrbk;
47+ license = licenses.gpl3;
48+ platforms = platforms.unix;
49+ maintainers = with maintainers; [ the-kenny ];
50+ inherit version;
51+ };
52+}
pkgs/top-level/all-packages.nix+2
@@ -769,6 +769,8 @@ let
769769
770770 btrfs-progs = callPackage ../tools/filesystems/btrfs-progs { };
771771
772+ btrbk = callPackage ../tools/backup/btrbk { };
773+
772774 bwm_ng = callPackage ../tools/networking/bwm-ng { };
773775
774776 byobu = callPackage ../tools/misc/byobu {