From 75164c11d52d01ba76213fbef5d618ef27a744c7 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 7 Aug 2012 12:34:29 -0500
Subject: lvm2 2.02.96

---
 abs/core/lvm2/PKGBUILD     | 58 ++++++++++++++++++++++++----------------------
 abs/core/lvm2/lvm.service  | 16 +++++++++++++
 abs/core/lvm2/lvm2.conf    |  2 ++
 abs/core/lvm2/lvm2_hook    | 39 +++++++++++++++----------------
 abs/core/lvm2/lvm2_install | 42 +++++++++++++++++----------------
 5 files changed, 89 insertions(+), 68 deletions(-)
 create mode 100644 abs/core/lvm2/lvm.service
 create mode 100644 abs/core/lvm2/lvm2.conf

diff --git a/abs/core/lvm2/PKGBUILD b/abs/core/lvm2/PKGBUILD
index b54e9f6..bda634b 100644
--- a/abs/core/lvm2/PKGBUILD
+++ b/abs/core/lvm2/PKGBUILD
@@ -1,37 +1,38 @@
-# $Id$
+# $Id: PKGBUILD 163019 2012-07-05 20:37:09Z eric $
 # Maintainer: Eric Bélanger <eric@archlinux.org>
 # Maintainer: Thomas Bächler <thomas@archlinux.org>
 
 pkgbase=lvm2
 pkgname=('lvm2' 'device-mapper')
-pkgver=2.02.86
-_pkgverlvm=${pkgver}
-pkgrel=1
+pkgver=2.02.96
+pkgrel=3
 arch=('i686' 'x86_64')
 url="http://sourceware.org/lvm2/"
 license=('GPL2' 'LGPL2.1')
 groups=('base')
-source=(ftp://sources.redhat.com/pub/lvm2/LVM2.${_pkgverlvm}.tgz
+source=(ftp://sources.redhat.com/pub/lvm2/LVM2.${pkgver}.tgz{,.asc}
         lvm2_install
         lvm2_hook
-        11-dm-initramfs.rules)
-md5sums=('3b42dec4d15ad106302a35149082a20e'
-         'dcb82506d732cc7b10159a89b579dba8'
-         '8d613b84a175cd85f752a75198e40e15'
-         '69e40679cd8b3658bfc619e48baae125')
-sha1sums=('f435b389cc11c8f415244fe382f3839d1676770c'
-          '7f108b2f2056eb050fc898bf5190ecf9145aed8a'
-          'a0e0513c2efb183006e57e595d93ce18be297928'
-          'f6a554eea9557c3c236df2943bb6e7e723945c41')
+        11-dm-initramfs.rules
+        lvm.service
+        lvm2.conf)
+sha1sums=('29d5097f0ca92c7665f29f862eca78bcf981ff6f'
+          '12e9016485c415c344524e6e75e23dfa6ca097ac'
+          '3e1680f9b76ce9150d08865d99db90fd15532271'
+          'cedc9948123c870f9c5aa3357d0075b41a9c8135'
+          'f6a554eea9557c3c236df2943bb6e7e723945c41'
+          '17df8689630a77e46899a8bd56997d9db896d5af'
+          'ccefad65fde3d50331a42b0e90a1539dc7c8b9e4')
 
 build() {
-  cd "${srcdir}/LVM2.${_pkgverlvm}"
-  sed -i 's|/usr/bin/tr|/bin/tr|' scripts/lvmdump.sh
+  cd "${srcdir}/LVM2.${pkgver}"
   unset LDFLAGS
-  ./configure --prefix= --sysconfdir=/etc --localstatedir=/var --datarootdir=/usr/share \
-    --includedir=/usr/include --with-usrlibdir=/usr/lib \
-    --enable-pkgconfig --enable-readline --enable-dmeventd --enable-cmdlib --enable-applib \
-    --with-udevdir=/lib/udev/rules.d/ --enable-udev_sync --enable-udev_rules
+
+  ./configure --prefix=/ --sbindir=/sbin --sysconfdir=/etc --localstatedir=/var --datarootdir=/usr/share \
+    --includedir=/usr/include --with-usrlibdir=/usr/lib  --libdir=/usr/lib --with-udev-prefix=/usr \
+    --with-systemdsystemunitdir=/usr/lib/systemd/system --enable-pkgconfig --enable-readline \
+    --enable-dmeventd --enable-cmdlib --enable-applib --enable-udev_sync --enable-udev_rules  \
+    --with-default-locking-dir=/run/lock/lvm
   make
 }
 
@@ -40,10 +41,10 @@ package_device-mapper() {
   url="http://sourceware.org/dm/"
   depends=('glibc' 'udev')
 
-  cd "${srcdir}/LVM2.${_pkgverlvm}"
+  cd "${srcdir}/LVM2.${pkgver}"
   make DESTDIR="${pkgdir}" install_device-mapper
   # extra udev rule for device-mapper in initramfs
-  install -D -m644 "${srcdir}/11-dm-initramfs.rules" "${pkgdir}/lib/initcpio/udev/11-dm-initramfs.rules"
+  install -D -m644 "${srcdir}/11-dm-initramfs.rules" "${pkgdir}/usr/lib/initcpio/udev/11-dm-initramfs.rules"
 }
 
 package_lvm2() {
@@ -53,15 +54,16 @@ package_lvm2() {
   backup=('etc/lvm/lvm.conf')
   options=('!makeflags')
 
-  cd "${srcdir}/LVM2.${_pkgverlvm}"
+  cd "${srcdir}/LVM2.${pkgver}"
   make DESTDIR="${pkgdir}" install_lvm2
   # install applib
-  cd liblvm
-  make DESTDIR="${pkgdir}" install
-  cd ..
+  make -C liblvm DESTDIR="${pkgdir}" install
   # /etc directories
   install -d "${pkgdir}"/etc/lvm/{archive,backup}
   # mkinitcpio hook
-  install -D -m644 "${srcdir}/lvm2_hook" "${pkgdir}/lib/initcpio/hooks/lvm2"
-  install -D -m644 "${srcdir}/lvm2_install" "${pkgdir}/lib/initcpio/install/lvm2"
+  install -D -m644 "${srcdir}/lvm2_hook" "${pkgdir}/usr/lib/initcpio/hooks/lvm2"
+  install -D -m644 "${srcdir}/lvm2_install" "${pkgdir}/usr/lib/initcpio/install/lvm2"
+  # systemd support
+  install -D -m644 "${srcdir}/lvm.service" "${pkgdir}/usr/lib/systemd/system/lvm.service"
+  install -D -m644 "${srcdir}/lvm2.conf" "${pkgdir}/usr/lib/tmpfiles.d/lvm2.conf"
 }
diff --git a/abs/core/lvm2/lvm.service b/abs/core/lvm2/lvm.service
new file mode 100644
index 0000000..277d5a7
--- /dev/null
+++ b/abs/core/lvm2/lvm.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=LVM activation
+DefaultDependencies=no
+Requires=systemd-udev-settle.service
+After=systemd-udev-settle.service
+Before=basic.target shutdown.target
+Conflicts=shutdown.target
+
+[Service]
+ExecStart=/sbin/vgchange --sysinit --available y
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+
+[Install]
+WantedBy=basic.target
diff --git a/abs/core/lvm2/lvm2.conf b/abs/core/lvm2/lvm2.conf
new file mode 100644
index 0000000..1298245
--- /dev/null
+++ b/abs/core/lvm2/lvm2.conf
@@ -0,0 +1,2 @@
+d /run/lock/lvm 0755 root root -
+d /run/lvm 0755 root root -
diff --git a/abs/core/lvm2/lvm2_hook b/abs/core/lvm2/lvm2_hook
index 874b91d..e69b334 100644
--- a/abs/core/lvm2/lvm2_hook
+++ b/abs/core/lvm2/lvm2_hook
@@ -1,25 +1,24 @@
-# vim:set ft=sh:
-run_hook ()
-{
-    /sbin/modprobe -q dm-mod >/dev/null 2>&1
-    if [ -e "/sys/class/misc/device-mapper" ]; then
-        if [ ! -e "/dev/mapper/control" ]; then
-            mkdir /dev/mapper
-            mknod "/dev/mapper/control" c $(cat /sys/class/misc/device-mapper/dev | sed 's|:| |')
-        fi
+#!/usr/bin/ash
 
-        # If the lvmwait= parameter has been specified on the command line
-        # wait for the device(s) before trying to activate the volume group(s)
-        if [ -n "${lvmwait}" ]; then
-            for pvdev in $(echo ${lvmwait} | sed 's|,| |g'); do
-                poll_device ${pvdev} ${rootdelay}
-            done
-        fi
+run_hook() {
+    local pvdev
 
-        [ "${quiet}" = "y" ] && LVMQUIET=">/dev/null"
+    modprobe -q dm-mod >/dev/null 2>&1
 
-        msg "Activating logical volumes..."
-        [ -d /etc/lvm ] && /sbin/lvm vgscan --sysinit
-        eval /sbin/lvm vgchange --sysinit -a y $LVMQUIET
+    # If the lvmwait= parameter has been specified on the command line
+    # wait for the device(s) before trying to activate the volume group(s)
+    for pvdev in ${lvmwait//,/ }; do
+        poll_device ${pvdev} ${rootdelay}
+    done
+
+    msg "Activating logical volumes..."
+    [ -d /etc/lvm ] && lvm vgscan
+
+    if [ -n "$quiet" ]; then
+      lvm vgchange --sysinit -a y >/dev/null
+    else
+      lvm vgchange --sysinit -a y
     fi
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/abs/core/lvm2/lvm2_install b/abs/core/lvm2/lvm2_install
index 94175b5..145ce49 100644
--- a/abs/core/lvm2/lvm2_install
+++ b/abs/core/lvm2/lvm2_install
@@ -1,29 +1,31 @@
-# vim: set ft=sh:
+#!/bin/bash
 
-build()
-{
-    MODULES=" dm-mod dm-snapshot dm-mirror"
-    BINARIES=""
-    FILES=""
-    SCRIPT="lvm2"
+build() {
+    local mod
+    for mod in dm-mod dm-snapshot dm-mirror; do
+        add_module "$mod"
+    done
 
     add_binary "/sbin/lvm"
     add_binary "/sbin/dmsetup"
-    add_file "/lib/udev/rules.d/10-dm.rules"
-    add_file "/lib/udev/rules.d/13-dm-disk.rules"
-    add_file "/lib/udev/rules.d/95-dm-notify.rules"
-    add_file "/lib/udev/rules.d/11-dm-lvm.rules"
-    add_file "/lib/initcpio/udev/11-dm-initramfs.rules" "/lib/udev/rules.d/11-dm-initramfs.rules"
+    add_file "/usr/lib/udev/rules.d/10-dm.rules"
+    add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
+    add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
+    add_file "/usr/lib/udev/rules.d/11-dm-lvm.rules"
+    add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
+
+    add_runscript
 }
 
-help ()
-{
-cat<<HELPEOF
-  This hook loads the necessary modules for an LVM2 root device.
+help() {
+  cat <<HELPEOF
+This hook loads the necessary modules for an LVM2 root device.
 
-  The optional lvmwait= parameter followed by a comma-separated
-  list of device names can be given on the command line.
-  It will cause the hook to wait until all given devices exist
-  before trying to scan and activate any volume groups.
+The optional lvmwait= parameter followed by a comma-separated
+list of device names can be given on the command line.
+It will cause the hook to wait until all given devices exist
+before trying to scan and activate any volume groups.
 HELPEOF
 }
+
+# vim: set ft=sh ts=4 sw=4 et:
-- 
cgit v0.12

