From 15471fc26d53c9431ebf69b06bb6ac0036484d54 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 16 Feb 2014 18:01:44 -0600
Subject: util-linux 2.2.4 update binary path to /usr/bin refs #961

---
 .../util-linux/0001-lsblk-fix-D-segfault.patch     | 45 +++++++++++++++++++
 ...mount-correctly-import-from-pylibmount.so.patch | 30 +++++++++++++
 abs/core/util-linux/PKGBUILD                       | 50 +++++++++++++++-------
 abs/core/util-linux/__changelog                    |  3 ++
 abs/core/util-linux/term_utils-agetty.patch        | 17 --------
 5 files changed, 113 insertions(+), 32 deletions(-)
 create mode 100644 abs/core/util-linux/0001-lsblk-fix-D-segfault.patch
 create mode 100644 abs/core/util-linux/0001-pylibmount-correctly-import-from-pylibmount.so.patch
 mode change 100644 => 100755 abs/core/util-linux/PKGBUILD
 create mode 100644 abs/core/util-linux/__changelog
 delete mode 100644 abs/core/util-linux/term_utils-agetty.patch

diff --git a/abs/core/util-linux/0001-lsblk-fix-D-segfault.patch b/abs/core/util-linux/0001-lsblk-fix-D-segfault.patch
new file mode 100644
index 0000000..8e4d7c6
--- /dev/null
+++ b/abs/core/util-linux/0001-lsblk-fix-D-segfault.patch
@@ -0,0 +1,45 @@
+From 71d842c01992b3678de4da4773ed54f08c0ab4f6 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Mon, 18 Nov 2013 11:27:35 +0100
+Subject: [PATCH] lsblk: fix -D segfault
+
+References: https://bugzilla.redhat.com/show_bug.cgi?id=1031262
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ misc-utils/lsblk.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
+index 9f7f1b6..9b53be3 100644
+--- a/misc-utils/lsblk.c
++++ b/misc-utils/lsblk.c
+@@ -903,7 +903,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
+ 		if (cxt->discard && p)
+ 			tt_line_set_data(ln, col, p);
+ 		else
+-			tt_line_set_data(ln, col, "0");
++			tt_line_set_data(ln, col, xstrdup("0"));
+ 		break;
+ 	case COL_DGRAN:
+ 		if (lsblk->bytes)
+@@ -936,7 +936,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
+ 		if (cxt->discard && p)
+ 			tt_line_set_data(ln, col, p);
+ 		else
+-			tt_line_set_data(ln, col, "0");
++			tt_line_set_data(ln, col, xstrdup("0"));
+ 		break;
+ 	case COL_WSAME:
+ 		if (lsblk->bytes)
+@@ -948,7 +948,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
+ 					   "queue/write_same_max_bytes", &x) == 0)
+ 				p = size_to_human_string(SIZE_SUFFIX_1LETTER, x);
+ 		}
+-		tt_line_set_data(ln, col, p ? p : "0");
++		tt_line_set_data(ln, col, p ? p : xstrdup("0"));
+ 		break;
+ 	};
+ }
+-- 
+1.8.4.2
+
diff --git a/abs/core/util-linux/0001-pylibmount-correctly-import-from-pylibmount.so.patch b/abs/core/util-linux/0001-pylibmount-correctly-import-from-pylibmount.so.patch
new file mode 100644
index 0000000..34040b9
--- /dev/null
+++ b/abs/core/util-linux/0001-pylibmount-correctly-import-from-pylibmount.so.patch
@@ -0,0 +1,30 @@
+From c8e5e6e7323642f7e6f12ee5f5231b0ec44c40ab Mon Sep 17 00:00:00 2001
+From: Dave Reisner <dreisner@archlinux.org>
+Date: Thu, 21 Nov 2013 12:25:27 -0500
+Subject: [PATCH] pylibmount: correctly import from pylibmount.so
+
+Without this, python is unable to find the module:
+
+$ python -c 'import libmount'
+Traceback (most recent call last):
+  File "<string>", line 1, in <module>
+  File "/usr/lib/python3.3/site-packages/libmount/__init__.py", line 1, in <module>
+    from pylibmount import *
+ImportError: No module named 'pylibmount'
+
+Signed-off-by: Dave Reisner <dreisner@archlinux.org>
+---
+ libmount/python/libmount/__init__.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libmount/python/libmount/__init__.py b/libmount/python/libmount/__init__.py
+index 243c639..09104e2 100644
+--- a/libmount/python/libmount/__init__.py
++++ b/libmount/python/libmount/__init__.py
+@@ -1,2 +1,2 @@
+-from pylibmount import *
++from .pylibmount import *
+ 
+-- 
+1.8.4.2
+
diff --git a/abs/core/util-linux/PKGBUILD b/abs/core/util-linux/PKGBUILD
old mode 100644
new mode 100755
index 857bcc4..53aa53e
--- a/abs/core/util-linux/PKGBUILD
+++ b/abs/core/util-linux/PKGBUILD
@@ -1,21 +1,26 @@
-# $Id: PKGBUILD 171469 2012-11-17 23:02:13Z allan $
+# $Id: PKGBUILD 201467 2013-12-12 15:33:24Z dreisner $
 # Maintainer: Tom Gundersen <teg@jklm.no>
+# Maintainer: Dave Reisner <dreisner@archlinux.org>
 # Contributor: judd <jvinet@zeroflux.org>
 
 pkgname=util-linux
-pkgver=2.22.1
-pkgrel=3
+pkgver=2.24
+pkgrel=2
 pkgdesc="Miscellaneous system utilities for Linux"
 url="http://www.kernel.org/pub/linux/utils/util-linux/"
 arch=('i686' 'x86_64')
-groups=('base')
+groups=('base' 'base-devel')
 depends=('pam' 'shadow' 'coreutils' 'glibc')
+optdepends=('python: python bindings to libmount')
+makedepends=('systemd' 'python2')
 # checkdepends=('bc')
 conflicts=('util-linux-ng' 'eject')
-provides=("util-linux-ng=${pkgver}" 'eject')
+provides=("util-linux-ng=$pkgver" 'eject')
 license=('GPL2')
-options=('!libtool')
-source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v2.22/${pkgname}-${pkgver}.tar.xz
+options=('strip' 'debug')
+source=("ftp://ftp.kernel.org/pub/linux/utils/$pkgname/v2.24/$pkgname-$pkgver.tar.xz"
+        0001-lsblk-fix-D-segfault.patch
+        0001-pylibmount-correctly-import-from-pylibmount.so.patch
         uuidd.tmpfiles
         pam-login
         pam-common
@@ -27,23 +32,31 @@ backup=(etc/pam.d/chfn
         etc/pam.d/su-l)
 install=util-linux.install
 
+prepare() {
+  cd "$pkgname-$pkgver"
+
+  patch -Np1 <"$srcdir"/0001-lsblk-fix-D-segfault.patch
+  patch -Np1 <"$srcdir"/0001-pylibmount-correctly-import-from-pylibmount.so.patch
+}
+
 build() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
+  cd "$pkgname-$pkgver"
 
   ./configure --prefix=/usr \
               --libdir=/usr/lib \
+              --bindir=/usr/bin \
               --localstatedir=/run \
-              --enable-fs-paths-extra=/usr/bin:/usr/sbin \
+              --enable-fs-paths-extra=/usr/bin \
               --enable-raw \
               --enable-vipw \
               --enable-newgrp \
               --enable-chfn-chsh \
               --enable-write \
               --enable-mesg \
-              --enable-socket-activation
+              --enable-socket-activation \
+              --with-python=2
 
 #              --enable-reset \ # part of ncurses
-#              --enable-line \ # not part of any package
 #              --enable-last \ # not compat
 
   make
@@ -55,12 +68,10 @@ build() {
 #}
 
 package() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
+  cd "$pkgname-$pkgver"
 
   make DESTDIR="${pkgdir}" install
 
-  cd "${pkgdir}"
-
   # setuid chfn and chsh
   chmod 4755 "$pkgdir"/usr/bin/{newgrp,ch{sh,fn}}
 
@@ -74,8 +85,17 @@ package() {
   # include tmpfiles fragment for uuidd
   # TODO(dreisner): offer this upstream?
   install -Dm644 "$srcdir/uuidd.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/uuidd.conf"
+
+  # usrmove
+  cd "$pkgdir"
+  mv {,usr/}sbin/* usr/bin
+  rmdir sbin usr/sbin
+
+  
 }
-md5sums=('730cf9932531ed09b53a04ca30fcb4c9'
+md5sums=('4fac6443427f575fc5f3531a4ad2ca01'
+         '1899fe3b853a5835c76cca0501b6b518'
+         'a18a1e89ffdfa3bc96ae976646a723ec'
          'a39554bfd65cccfd8254bb46922f4a67'
          '4368b3f98abd8a32662e094c54e7f9b1'
          'a31374fef2cba0ca34dfc7078e2969e4'
diff --git a/abs/core/util-linux/__changelog b/abs/core/util-linux/__changelog
new file mode 100644
index 0000000..31b27cd
--- /dev/null
+++ b/abs/core/util-linux/__changelog
@@ -0,0 +1,3 @@
+changed python from 3->2
+ mv $pkgdir/usr/bin/logger $pkgdir/usr/bin/logger-util-linux
+
diff --git a/abs/core/util-linux/term_utils-agetty.patch b/abs/core/util-linux/term_utils-agetty.patch
deleted file mode 100644
index f0b37b3..0000000
--- a/abs/core/util-linux/term_utils-agetty.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- term-utils/agetty.orig	2012-08-02 19:44:36.234757299 +0000
-+++ term-utils/agetty.c	2012-08-02 19:47:15.464752505 +0000
-@@ -961,12 +961,12 @@
- 		 */
- 
- 		if ((fcntl(STDIN_FILENO, F_GETFL, 0) & O_RDWR) != O_RDWR)
--			log_err(_("%s: not open for read/write"), tty);
-+			log_warn(_("%s: not open for read/write"), tty);
- 
- 	}
- 
- 	if (tcsetpgrp(STDIN_FILENO, pid))
--		log_err("/dev/%s: cannot set process group: %m", tty);
-+		log_warn("/dev/%s: cannot set process group: %m", tty);
- 
- 	/* Get rid of the present outputs. */
- 	close(STDOUT_FILENO);
-- 
cgit v0.12