diff options
Diffstat (limited to 'libre-testing/lvm2')
-rw-r--r-- | libre-testing/lvm2/11-dm-initramfs.rules | 3 | ||||
-rw-r--r-- | libre-testing/lvm2/PKGBUILD | 124 | ||||
-rw-r--r-- | libre-testing/lvm2/lvm2.install | 25 | ||||
-rw-r--r-- | libre-testing/lvm2/lvm2_hook | 25 | ||||
-rw-r--r-- | libre-testing/lvm2/lvm2_install | 43 | ||||
-rw-r--r-- | libre-testing/lvm2/sd-lvm2_install | 46 |
6 files changed, 266 insertions, 0 deletions
diff --git a/libre-testing/lvm2/11-dm-initramfs.rules b/libre-testing/lvm2/11-dm-initramfs.rules new file mode 100644 index 000000000..d2c167324 --- /dev/null +++ b/libre-testing/lvm2/11-dm-initramfs.rules @@ -0,0 +1,3 @@ +# needed with new udev/mkinitcpio and as implemented in dracut: +# <http://git.kernel.org/?p=boot/dracut/dracut.git;a=commitdiff;h=12b9736228f2b34c15a9cb63be79cf7b6e865b54> +SUBSYSTEM=="block", KERNEL=="dm-[0-9]*", ACTION=="add|change", OPTIONS="db_persist" diff --git a/libre-testing/lvm2/PKGBUILD b/libre-testing/lvm2/PKGBUILD new file mode 100644 index 000000000..d833669ab --- /dev/null +++ b/libre-testing/lvm2/PKGBUILD @@ -0,0 +1,124 @@ +# Maintainer: Eric Bélanger <eric@archlinux.org> +# Maintainer: Thomas Bächler <thomas@archlinux.org> + +pkgbase=lvm2 +pkgname=('lvm2' 'device-mapper') +pkgver=2.02.181 +pkgrel=1 +arch=(x86_64 ppc64le) +url='https://sourceware.org/lvm2/' +license=('GPL2' 'LGPL2.1') +makedepends=('git' 'systemd' 'thin-provisioning-tools') +groups=('base') +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" + 'lvm2_install' + 'lvm2_hook' + 'sd-lvm2_install' + '11-dm-initramfs.rules') +sha256sums=('SKIP' + 'cc51940a8437f3c8339bb9cec7e929b2cc0852ffc8a0b2463e6f67ca2b9950f6' + '97d7c92e4954bc0108e7cd183b2eb5fe7ecc97e6f56369669e6537cb6ed45d80' + 'b749c2da0e9307b0c2c3858d024a19c268e01e393e876a284fe1a302427f72f1' + 'e10f24b57582d6e2da71f7c80732a62e0ee2e3b867fe84591ccdb53e80fa92e0') + +prepare() { + cd lvm2/ + + # remove install section from systemd units that are enabled by default + sed -i -e '/^\[Install\]$/,$d' \ + scripts/dm_event_systemd_red_hat.socket.in \ + scripts/lvm2_lvmetad_systemd_red_hat.socket.in \ + scripts/lvm2_lvmpolld_systemd_red_hat.socket.in \ + scripts/lvm2_monitoring_systemd_red_hat.service.in +} + +build() { + local _CONFIGUREOPTS=( + --prefix=/usr + --sbindir=/usr/bin + --sysconfdir=/etc + --localstatedir=/var + --enable-applib + --enable-cmdlib + --enable-dmeventd + --enable-lvmetad + --enable-lvmpolld + --enable-pkgconfig + --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 + --with-default-pid-dir=/run + --with-default-run-dir=/run/lvm + --with-systemdsystemunitdir=/usr/lib/systemd/system + --with-thin=internal + --with-udev-prefix=/usr + ) + + cp -a lvm2/ lvm2-initramfs/ + + cd lvm2/ + + ./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 udev + make 69-dm-lvm-metad.rules +} + +package_device-mapper() { + pkgdesc="Device mapper userspace library and tools" + url="http://sourceware.org/dm/" + depends=('glibc' 'libsystemd') + + cd lvm2/ + + 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 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" + 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' 'libutil-linux' 'readline' 'thin-provisioning-tools') + conflicts=('lvm' 'mkinitcpio<0.7') + backup=('etc/lvm/lvm.conf' + 'etc/lvm/lvmlocal.conf') + options=('!makeflags') + install=lvm2.install + + 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" + # 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" + # 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" + 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" + make DESTDIR="${pkgdir}" install_systemd_generators +} diff --git a/libre-testing/lvm2/lvm2.install b/libre-testing/lvm2/lvm2.install new file mode 100644 index 000000000..e11834d44 --- /dev/null +++ b/libre-testing/lvm2/lvm2.install @@ -0,0 +1,25 @@ +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/libre-testing/lvm2/lvm2_hook b/libre-testing/lvm2/lvm2_hook new file mode 100644 index 000000000..3c28d67ff --- /dev/null +++ b/libre-testing/lvm2/lvm2_hook @@ -0,0 +1,25 @@ +#!/usr/bin/ash + +run_earlyhook() { + mkdir /run/lvm + lvmetad +} + +# We are suffering a race condition in non-systemd initramfs: If lvmetad is +# killed before pvscan processes finish we have stale processes and +# uninitialized physical volumes. So wait for pvscan processes to finish. +# Break after 10 seconds (50*0.2s) to avaid infinite loop. +run_latehook() { + local i=50 + + while pgrep -f pvscan >/dev/null 2>/dev/null && [ $i -gt 0 ]; do + sleep 0.2 + i=$((i - 1)) + done +} + +run_cleanuphook() { + kill $(cat /run/lvmetad.pid) +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/libre-testing/lvm2/lvm2_install b/libre-testing/lvm2/lvm2_install new file mode 100644 index 000000000..d7a63332a --- /dev/null +++ b/libre-testing/lvm2/lvm2_install @@ -0,0 +1,43 @@ +#!/usr/bin/bash + +build() { + local mod + local symlink + + # device mapper modules + for mod in dm-mod dm-snapshot dm-mirror dm-cache dm-cache-smq dm-thin-pool; do + add_module "$mod" + done + + # binaries from lvm2 + add_binary "lvm" + add_binary "lvmetad" + + # beinaries from device-mapper + add_binary "dmsetup" + + # from thin-provisioning-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/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 +} + +help() { + cat <<HELPEOF +This hook enables LVM2 volumes in initramfs. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/libre-testing/lvm2/sd-lvm2_install b/libre-testing/lvm2/sd-lvm2_install new file mode 100644 index 000000000..5579b1c90 --- /dev/null +++ b/libre-testing/lvm2/sd-lvm2_install @@ -0,0 +1,46 @@ +#!/usr/bin/bash + +build() { + local mod + local symlink + + # device mapper modules + for mod in dm-mod dm-snapshot dm-mirror dm-cache dm-cache-smq dm-thin-pool; do + add_module "$mod" + done + + # device mapper and lvm2 systemd units + # binaries and libraries are pull automatically, except ... + add_systemd_unit "lvm2-lvmetad.service" + add_systemd_unit "lvm2-pvscan@.service" + + # binaries from lvm2 + add_binary "lvm" + add_binary "lvmetad" + + # beinaries from device-mapper + add_binary "dmsetup" + + # from thin-provisioning-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/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" +} + +help() { + cat <<HELPEOF +This hook enables LVM2 volumes in systemd-based initramfs. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: |