From b941d38c40a0ac08e7db249ba2c9b99f4bda2c23 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 28 Jan 2016 13:00:43 +0000
Subject: btrfs-progs: update to 4.4

---
 abs/core/btrfs-progs/PKGBUILD             | 69 ++++++++++++++++++-------------
 abs/core/btrfs-progs/btrfs-progs.install  | 10 ++++-
 abs/core/btrfs-progs/btrfs-scrub@.service |  7 ++++
 abs/core/btrfs-progs/btrfs-scrub@.timer   | 10 +++++
 4 files changed, 66 insertions(+), 30 deletions(-)
 create mode 100644 abs/core/btrfs-progs/btrfs-scrub@.service
 create mode 100644 abs/core/btrfs-progs/btrfs-scrub@.timer

diff --git a/abs/core/btrfs-progs/PKGBUILD b/abs/core/btrfs-progs/PKGBUILD
index 47d6884..06a6603 100644
--- a/abs/core/btrfs-progs/PKGBUILD
+++ b/abs/core/btrfs-progs/PKGBUILD
@@ -1,47 +1,60 @@
-# $Id: PKGBUILD 202441 2013-12-21 23:13:17Z tomegun $
-# Maintainer: Tom Gundersen <teg@jklm.no>
+# $Id$
+# Maintainer: Sébastien "Seblu" Luttringer <seblu@archlinux.org>
+# Contributor: Tom Gundersen <teg@jklm.no>
 # Contributor: Tobias Powalowski <tpowa@archlinux.org>
 
 pkgname=btrfs-progs
-pkgver=3.12
+pkgver=4.4
 pkgrel=1
-pkgdesc="btrfs filesystem utilities"
-arch=(i686 x86_64)
-depends=('glibc' 'e2fsprogs' 'lzo2')
-makedepends=('git')
-url="http://btrfs.wiki.kernel.org/"
+pkgdesc='Btrfs filesystem utilities'
+arch=('i686' 'x86_64')
+depends=('glibc' 'libutil-linux' 'e2fsprogs' 'lzo' 'zlib')
+makedepends=('git' 'asciidoc' 'xmlto')
+url='http://btrfs.wiki.kernel.org/'
 replaces=('btrfs-progs-unstable')
 conflicts=('btrfs-progs-unstable')
 provides=('btrfs-progs-unstable')
 license=('GPL2')
-source=("git://git.kernel.org/pub/scm/linux/kernel/git/mason/${pkgname}.git#tag=v${pkgver}"
-	initcpio-install-btrfs
-	initcpio-hook-btrfs)
+source=("git://git.kernel.org/pub/scm/linux/kernel/git/kdave/$pkgname.git#tag=v$pkgver"
+        'initcpio-install-btrfs'
+        'initcpio-hook-btrfs'
+        'btrfs-scrub@.service'
+        'btrfs-scrub@.timer')
 install=btrfs-progs.install
 options=(!staticlibs)
+md5sums=('SKIP'
+         '7241ba3a4286d08da0d50b7176941112'
+         'b09688a915a0ec8f40e2f5aacbabc9ad'
+         '794b867e09451284c545bae112aa0cfd'
+         'a290e0ab88b7b4675cd20f5a2befc8cb')
 
 build() {
-   cd $pkgname
-   make CFLAGS="$CFLAGS"
-   make CFLAGS="$CFLAGS" btrfs-select-super
+  cd $pkgname
+  ./autogen.sh
+  ./configure --prefix=/usr
+  make
+}
+
+check() {
+  cd $pkgname
+ ./btrfs filesystem show
 }
 
 package() {
-   cd $pkgname
+  cd $pkgname
+  make prefix="$pkgdir"/usr install
 
-   make prefix=$pkgdir/usr install
-   install -Dm755 btrfs-select-super $pkgdir/usr/bin
+  # install bash completion (FS#44618)
+  install -Dm644 btrfs-completion "$pkgdir/usr/share/bash-completion/completions/btrfs"
 
-   # fix manpage
-   mkdir -p $pkgdir/usr/share/
-   mv $pkgdir/usr/man $pkgdir/usr/share/man
+  # install mkinitcpio hooks
+  cd "$srcdir"
+  install -Dm644 initcpio-install-btrfs "$pkgdir/usr/lib/initcpio/install/btrfs"
+  install -Dm644 initcpio-hook-btrfs "$pkgdir/usr/lib/initcpio/hooks/btrfs"
 
-   # install mkinitcpio hooks
-   install -Dm644 "$srcdir/initcpio-install-btrfs" \
-     "$pkgdir/usr/lib/initcpio/install/btrfs"
-   install -Dm644 "$srcdir/initcpio-hook-btrfs" \
-     "$pkgdir/usr/lib/initcpio/hooks/btrfs"
+  # install scrub service/timer
+  install -Dm644 btrfs-scrub@.service "$pkgdir/usr/lib/systemd/system/btrfs-scrub@.service"
+  install -Dm644 btrfs-scrub@.timer "$pkgdir/usr/lib/systemd/system/btrfs-scrub@.timer"
 }
-md5sums=('SKIP'
-         '7241ba3a4286d08da0d50b7176941112'
-         'b09688a915a0ec8f40e2f5aacbabc9ad')
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/abs/core/btrfs-progs/btrfs-progs.install b/abs/core/btrfs-progs/btrfs-progs.install
index d6c0698..1e75f02 100644
--- a/abs/core/btrfs-progs/btrfs-progs.install
+++ b/abs/core/btrfs-progs/btrfs-progs.install
@@ -1,8 +1,14 @@
 #!/bin/sh
 
+## arg 1:  the new package version
+## arg 2:  the old package version
 post_upgrade() {
-  if [ "$(vercmp 0.19.20121005 "$2")" -eq 1 ]; then
-    echo "btrfs multi-device support now relies on linux 3.6 or later"
+  if (( "$(vercmp "$2" 0.19.20121005)" < 0 )); then
+    echo 'btrfs multi-device support now relies on linux 3.6 or later'
+  elif (( "$(vercmp "$2" 4.3.1-2)" < 0 )); then
+    echo 'btrfs-scrub@.timer instance names must not be prefix by dash anymore'
+    echo 'use btrfs-scrub@-.timer to scrub / monthly'
+    echo '    btrfs-scrub@home.timer to scrub /home monthly.'
   fi
 }
 
diff --git a/abs/core/btrfs-progs/btrfs-scrub@.service b/abs/core/btrfs-progs/btrfs-scrub@.service
new file mode 100644
index 0000000..9b83ded
--- /dev/null
+++ b/abs/core/btrfs-progs/btrfs-scrub@.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Btrfs scrub on %f
+
+[Service]
+Nice=19
+IOSchedulingClass=idle
+ExecStart=/usr/bin/btrfs scrub start -B %f
diff --git a/abs/core/btrfs-progs/btrfs-scrub@.timer b/abs/core/btrfs-progs/btrfs-scrub@.timer
new file mode 100644
index 0000000..c4d8730
--- /dev/null
+++ b/abs/core/btrfs-progs/btrfs-scrub@.timer
@@ -0,0 +1,10 @@
+[Unit]
+Description=Monthly Btrfs scrub on %I
+
+[Timer]
+OnCalendar=monthly
+AccuracySec=1d
+Persistent=true
+
+[Install]
+WantedBy=multi-user.target
-- 
cgit v0.12

