From 6fd74d8dbdee455d63c717cf2af1080f774014e7 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 4 Oct 2020 15:27:17 +0000
Subject: lvm2: update to 2.02.187

---
 abs/core/lvm2/0001-fix-ordering-in-initramfs.patch | 21 +++++
 abs/core/lvm2/PKGBUILD                             | 92 ++++++++++++++--------
 abs/core/lvm2/lvm2.install                         | 25 ------
 abs/core/lvm2/lvm2_install                         | 19 ++---
 abs/core/lvm2/sd-lvm2_install                      | 17 ++--
 5 files changed, 94 insertions(+), 80 deletions(-)
 create mode 100644 abs/core/lvm2/0001-fix-ordering-in-initramfs.patch
 delete mode 100644 abs/core/lvm2/lvm2.install

diff --git a/abs/core/lvm2/0001-fix-ordering-in-initramfs.patch b/abs/core/lvm2/0001-fix-ordering-in-initramfs.patch
new file mode 100644
index 0000000..ec2c4b1
--- /dev/null
+++ b/abs/core/lvm2/0001-fix-ordering-in-initramfs.patch
@@ -0,0 +1,21 @@
+From bc5886440e8573717a525bceb46ebe99dad9bce7 Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail@eworm.de>
+Date: Tue, 2 Jun 2020 09:30:30 +0200
+Subject: [PATCH] fix ordering in initramfs
+---
+ scripts/lvm2_lvmetad_systemd_red_hat.service.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
+index 960f32dab..0b5ce1b79 100644
+--- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in
++++ b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
+@@ -3,7 +3,7 @@ Description=LVM2 metadata daemon
+ Documentation=man:lvmetad(8)
+ Requires=lvm2-lvmetad.socket
+ Before=shutdown.target
+-After=lvm2-lvmetad.socket
++After=lvm2-lvmetad.socket systemd-udevd.service
+ DefaultDependencies=no
+ Conflicts=shutdown.target
+ 
diff --git a/abs/core/lvm2/PKGBUILD b/abs/core/lvm2/PKGBUILD
index a449821..7bdd949 100644
--- a/abs/core/lvm2/PKGBUILD
+++ b/abs/core/lvm2/PKGBUILD
@@ -1,34 +1,44 @@
-# $Id$
 # Maintainer: Eric Bélanger <eric@archlinux.org>
 # Maintainer: Thomas Bächler <thomas@archlinux.org>
 
 pkgbase=lvm2
 pkgname=('lvm2' 'device-mapper')
-pkgver=2.02.177
-pkgrel=4
+pkgver=2.02.187
+pkgrel=3
 arch=('x86_64')
-url="http://sourceware.org/lvm2/"
+url='https://sourceware.org/lvm2/'
 license=('GPL2' 'LGPL2.1')
-makedepends=('systemd' 'thin-provisioning-tools')
-groups=('base')
-validpgpkeys=('88437EF5C077BD113D3B7224228191C1567E2C17') # Alasdair G Kergon <agk@redhat.com>
-source=("https://mirrors.kernel.org/sourceware/lvm2/releases/LVM2.${pkgver}.tgz"{,.asc}
+makedepends=('git' 'systemd' 'thin-provisioning-tools')
+validpgpkeys=('88437EF5C077BD113D3B7224228191C1567E2C17'  # Alasdair G Kergon <agk@redhat.com>
+              'D501A478440AE2FD130A1BE8B9112431E509039F') # Marian Csontos <marian.csontos@gmail.com>
+source=("git+https://sourceware.org/git/lvm2.git#tag=v${pkgver//./_}?signed"
+        '0001-fix-ordering-in-initramfs.patch'
         'lvm2_install'
         'lvm2_hook'
         'sd-lvm2_install'
         '11-dm-initramfs.rules')
-sha256sums=('4025a23ec9b15c2cb7486d151c29dc953b75efc4d452cfe9dbbc7c0fac8e80f2'
-            'SKIP'
-            '5129f87a8b30d5a8621e9c1c0664910a588bdd77bff09473afb73efb41305cbb'
+sha256sums=('SKIP'
+            '7a34b263e51d5a71e0595bba163de478f4f14a26015b11e682406e4adf7ba656'
+            'cc51940a8437f3c8339bb9cec7e929b2cc0852ffc8a0b2463e6f67ca2b9950f6'
             '97d7c92e4954bc0108e7cd183b2eb5fe7ecc97e6f56369669e6537cb6ed45d80'
-            'cc1ed670a7ca21ee2ab32ad6b5ab7a6a5e86d0651ea2e1593e289a82c87aa4da'
+            'b749c2da0e9307b0c2c3858d024a19c268e01e393e876a284fe1a302427f72f1'
             'e10f24b57582d6e2da71f7c80732a62e0ee2e3b867fe84591ccdb53e80fa92e0')
 
+_backports=(
+  # udev: remove unsupported OPTIONS+="event_timeout" rule
+  '125f27ac37bc9b93cc96f64052b9681b3d479ee1'
+)
+
 prepare() {
-  cd LVM2.${pkgver}
+  cd lvm2/
+
+  local _c
+  for _c in "${_backports[@]}"; do
+    git log --oneline -1 "${_c}"
+    git show "${_c}" -- ':(exclude)WHATS_NEW' | git apply
+  done
 
-  # enable lvmetad
-  sed -i 's|use_lvmetad = 0|use_lvmetad = 1|' conf/example.conf.in
+  patch -Np1 < ../0001-fix-ordering-in-initramfs.patch
 
   # remove install section from systemd units that are enabled by default
   sed -i -e '/^\[Install\]$/,$d' \
@@ -39,7 +49,8 @@ prepare() {
 }
 
 build() {
-  local CONFIGUREOPTS=(
+  local _CONFIGUREOPTS=(
+    CONFIG_SHELL=/bin/bash
     --prefix=/usr
     --sbindir=/usr/bin
     --sysconfdir=/etc
@@ -53,6 +64,7 @@ build() {
     --enable-readline
     --enable-udev_rules
     --enable-udev_sync
+    --enable-use-lvmetad
     --with-cache=internal
     --with-default-dm-run-dir=/run
     --with-default-locking-dir=/run/lock/lvm
@@ -63,16 +75,25 @@ build() {
     --with-udev-prefix=/usr
   )
 
-  cp -a LVM2.${pkgver} LVM2-initramfs
+  # build system requires bash:
+  # https://www.redhat.com/archives/linux-lvm/2020-January/msg00004.html
+  # https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html
+  export CONFIG_SHELL=/bin/bash
+
+  cp -a lvm2/ lvm2-initramfs/
 
-  cd LVM2.${pkgver}
+  cd lvm2/
 
-  ./configure "${CONFIGUREOPTS[@]}" --enable-udev-systemd-background-jobs
+  ./configure \
+    "${_CONFIGUREOPTS[@]}" \
+    --enable-udev-systemd-background-jobs
   make
 
   # Build legacy udev rule for initramfs
-  cd ../LVM2-initramfs
-  ./configure "${CONFIGUREOPTS[@]}" --enable-udev-systemd-background-jobs=no
+  cd ../lvm2-initramfs
+  ./configure \
+    "${_CONFIGUREOPTS[@]}" \
+    --enable-udev-systemd-background-jobs=no
   cd udev
   make 69-dm-lvm-metad.rules
 }
@@ -80,44 +101,49 @@ build() {
 package_device-mapper() {
   pkgdesc="Device mapper userspace library and tools"
   url="http://sourceware.org/dm/"
-  depends=('glibc' 'libsystemd')
+  depends=('glibc' 'systemd-libs' 'libudev.so')
+  provides=('libdevmapper.so'
+    'libdevmapper-event.so')
+
+  cd lvm2/
 
-  cd 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}/usr/lib/initcpio/udev/11-dm-initramfs.rules"
+  install -D -m0644 "${srcdir}/11-dm-initramfs.rules" "${pkgdir}/usr/lib/initcpio/udev/11-dm-initramfs.rules"
   # Install dmeventd socket and service
   make DESTDIR="${pkgdir}" install_systemd_units
   rm -f "${pkgdir}/usr/lib/systemd/system/"{blk-availability.service,lvm2-*}
-  install -d -m755 "${pkgdir}/usr/lib/systemd/system/sockets.target.wants"
+  install -d -m0755 "${pkgdir}/usr/lib/systemd/system/sockets.target.wants"
   ln -sf ../dm-event.socket "${pkgdir}/usr/lib/systemd/system/sockets.target.wants/dm-event.socket"
 }
 
 package_lvm2() {
   pkgdesc="Logical Volume Manager 2 utilities"
-  depends=('bash' "device-mapper>=${pkgver}" 'libsystemd' 'readline' 'thin-provisioning-tools')
+  depends=('bash' "device-mapper>=${pkgver}" 'libdevmapper.so' 'systemd-libs'
+    'libudev.so' 'util-linux-libs' 'libblkid.so' 'readline' 'libreadline.so'
+    'thin-provisioning-tools')
   conflicts=('lvm' 'mkinitcpio<0.7')
   backup=('etc/lvm/lvm.conf'
     'etc/lvm/lvmlocal.conf')
   options=('!makeflags')
-  install=lvm2.install
 
-  cd LVM2.${pkgver}
+  cd lvm2/
+
   make DESTDIR="${pkgdir}" install_lvm2
   # install applib
   make -C liblvm DESTDIR="${pkgdir}" install
   # /etc directories
   install -d "${pkgdir}"/etc/lvm/{archive,backup}
   # mkinitcpio hook
-  install -D -m644 "${srcdir}/lvm2_hook" "${pkgdir}/usr/lib/initcpio/hooks/lvm2"
-  install -D -m644 "${srcdir}/lvm2_install" "${pkgdir}/usr/lib/initcpio/install/lvm2"
-  install -D -m644 "${srcdir}/sd-lvm2_install" "${pkgdir}/usr/lib/initcpio/install/sd-lvm2"
+  install -D -m0644 "${srcdir}/lvm2_hook" "${pkgdir}/usr/lib/initcpio/hooks/lvm2"
+  install -D -m0644 "${srcdir}/lvm2_install" "${pkgdir}/usr/lib/initcpio/install/lvm2"
+  install -D -m0644 "${srcdir}/sd-lvm2_install" "${pkgdir}/usr/lib/initcpio/install/sd-lvm2"
   # extra udev rule for lvmetad in non-systemd initramfs
-  install -D -m644 "${srcdir}/LVM2-initramfs/udev/69-dm-lvm-metad.rules" "${pkgdir}/usr/lib/initcpio/udev/69-dm-lvm-metad.rules"
+  install -D -m0644 "${srcdir}/lvm2-initramfs/udev/69-dm-lvm-metad.rules" "${pkgdir}/usr/lib/initcpio/udev/69-dm-lvm-metad.rules"
   # systemd support
   make DESTDIR="${pkgdir}" install_systemd_units
   rm -f "${pkgdir}/usr/lib/systemd/system/"dm-*
-  install -d -m755 "${pkgdir}/usr/lib/systemd/system/sysinit.target.wants"
+  install -d -m0755 "${pkgdir}/usr/lib/systemd/system/sysinit.target.wants"
   ln -sf ../lvm2-lvmetad.socket "${pkgdir}/usr/lib/systemd/system/sysinit.target.wants/lvm2-lvmetad.socket"
   ln -sf ../lvm2-lvmpolld.socket "${pkgdir}/usr/lib/systemd/system/sysinit.target.wants/lvm2-lvmpolld.socket"
   ln -sf ../lvm2-monitor.service "${pkgdir}/usr/lib/systemd/system/sysinit.target.wants/lvm2-monitor.service"
diff --git a/abs/core/lvm2/lvm2.install b/abs/core/lvm2/lvm2.install
deleted file mode 100644
index e11834d..0000000
--- a/abs/core/lvm2/lvm2.install
+++ /dev/null
@@ -1,25 +0,0 @@
-post_upgrade() {
-  if [ $(vercmp $2 2.02.98-2) -lt 0 ]; then
-    echo "Changes to the lvm2 package:"
-    echo " + Activating lvm in mkinitcpio now requires both the 'udev' and 'lvm2' hooks."
-    echo " + LVM volumes are automatically activated by udev (full hotplug support)."
-    echo " + You MUST have use_lvmetad = 1 in /etc/lvm/lvm.conf (the default)."
-    echo " + If you uncomment auto_activation_volume_list in /etc/lvm/lvm.conf, only the"
-    echo "   volumes listed there will be activated (default: it is commented out)."
-    if [ -f /etc/lvm/lvm.conf.pacnew ]; then
-        echo "WARNING: /etc/lvm/lvm.conf.pacnew exists. You MUST merge the required changes"
-        echo "         into /etc/lvm/lvm.conf or LVM will fail to work."
-    fi
-  fi
-
-  if [ $(vercmp $2 2.02.106-2) -lt 0 ]; then
-    if [ -L /etc/systemd/system/sysinit.target.wants/lvm-monitoring.service ]; then
-      echo "rm /etc/systemd/system/sysinit.target.wants/lvm-monitoring.service"
-      rm /etc/systemd/system/sysinit.target.wants/lvm-monitoring.service
-      echo "ln -s /usr/lib/systemd/system/lvm2-monitor.service /etc/systemd/system/sysinit.target.wants/lvm2-monitor.service"
-      ln -s /usr/lib/systemd/system/lvm2-monitor.service /etc/systemd/system/sysinit.target.wants/lvm2-monitor.service
-    fi
-  fi
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/abs/core/lvm2/lvm2_install b/abs/core/lvm2/lvm2_install
index e0be711..d7a6333 100644
--- a/abs/core/lvm2/lvm2_install
+++ b/abs/core/lvm2/lvm2_install
@@ -10,30 +10,25 @@ build() {
     done
 
     # binaries from lvm2
-    add_binary "/usr/bin/lvm"
-    add_binary "/usr/bin/lvmetad"
+    add_binary "lvm"
+    add_binary "lvmetad"
 
     # beinaries from device-mapper
-    add_binary "/usr/bin/dmsetup"
-    add_binary "/usr/bin/dmeventd"
-
-    # these are dlopen()ed
-    for library in libdevmapper-event-lvm2{mirror,raid,snapshot,thin}; do
-    	add_binary "/usr/lib/${library}.so"
-    done
+    add_binary "dmsetup"
 
     # from thin-provisioning-tools
-    add_binary "/usr/bin/pdata_tools"
+    add_binary "pdata_tools"
     for symlink in cache_{check,dump,metadata_size,repair,restore} thin_{check,delta,dump,ls,metadata_size,repair,restore,rmap,trim}; do
         add_symlink "/usr/bin/${symlink}" "pdata_tools"
     done
 
+    # udev rules and lvm configuration
     add_file "/usr/lib/udev/rules.d/10-dm.rules"
+    add_file "/usr/lib/udev/rules.d/11-dm-lvm.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/69-dm-lvm-metad.rules" "/usr/lib/udev/rules.d/69-dm-lvm-metad.rules"
     add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
+    add_file "/usr/lib/initcpio/udev/69-dm-lvm-metad.rules" "/usr/lib/udev/rules.d/69-dm-lvm-metad.rules"
     add_file "/etc/lvm/lvm.conf"
 
     add_runscript
diff --git a/abs/core/lvm2/sd-lvm2_install b/abs/core/lvm2/sd-lvm2_install
index f90cc82..5579b1c 100644
--- a/abs/core/lvm2/sd-lvm2_install
+++ b/abs/core/lvm2/sd-lvm2_install
@@ -11,18 +11,15 @@ build() {
 
     # device mapper and lvm2 systemd units
     # binaries and libraries are pull automatically, except ...
-    add_systemd_unit "dm-event.service"
     add_systemd_unit "lvm2-lvmetad.service"
     add_systemd_unit "lvm2-pvscan@.service"
-    add_symlink "/usr/lib/systemd/system/sysinit.target.wants/lvm2-lvmetad.socket"
 
-    # ... dmsetup and ...
-    add_binary "dmsetup"
+    # binaries from lvm2
+    add_binary "lvm"
+    add_binary "lvmetad"
 
-    # ... these, which are dlopen()ed
-    for library in libdevmapper-event-lvm2{mirror,raid,snapshot,thin}; do
-    	add_binary "/usr/lib/${library}.so"
-    done
+    # beinaries from device-mapper
+    add_binary "dmsetup"
 
     # from thin-provisioning-tools
     add_binary "pdata_tools"
@@ -32,10 +29,10 @@ build() {
 
     # udev rules and lvm configuration
     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/udev/rules.d/13-dm-disk.rules"
     add_file "/usr/lib/udev/rules.d/69-dm-lvm-metad.rules"
+    add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
     add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
     add_file "/etc/lvm/lvm.conf"
 }
-- 
cgit v0.12

