diff options
Diffstat (limited to 'core/lvm2')
-rw-r--r-- | core/lvm2/PKGBUILD | 52 | ||||
-rw-r--r-- | core/lvm2/dmeventd.service | 14 | ||||
-rw-r--r-- | core/lvm2/dmeventd.socket | 11 | ||||
-rw-r--r-- | core/lvm2/lvm-monitoring.service | 18 | ||||
-rw-r--r-- | core/lvm2/lvm-on-crypt.service | 16 | ||||
-rw-r--r-- | core/lvm2/lvm.service | 16 | ||||
-rw-r--r-- | core/lvm2/lvm2.install | 16 | ||||
-rw-r--r-- | core/lvm2/lvm2_hook | 24 | ||||
-rw-r--r-- | core/lvm2/lvm2_install | 14 | ||||
-rw-r--r-- | core/lvm2/lvmetad.service | 16 | ||||
-rw-r--r-- | core/lvm2/lvmetad.socket | 10 |
11 files changed, 132 insertions, 75 deletions
diff --git a/core/lvm2/PKGBUILD b/core/lvm2/PKGBUILD index 014eeb8ad..f34523f4d 100644 --- a/core/lvm2/PKGBUILD +++ b/core/lvm2/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 169698 2012-10-26 08:32:04Z thomas $ +# $Id: PKGBUILD 177953 2013-02-12 12:13:50Z thomas $ # Maintainer: Eric Bélanger <eric@archlinux.org> # Maintainer: Thomas Bächler <thomas@archlinux.org> pkgbase=lvm2 pkgname=('lvm2' 'device-mapper') pkgver=2.02.98 -pkgrel=1 +pkgrel=3 arch=('i686' 'x86_64') url="http://sourceware.org/lvm2/" license=('GPL2' 'LGPL2.1') @@ -14,27 +14,34 @@ source=(ftp://sources.redhat.com/pub/lvm2/LVM2.${pkgver}.tgz{,.asc} lvm2_install lvm2_hook 11-dm-initramfs.rules - lvm.service - lvm-on-crypt.service - lvm2.conf) + lvm2.conf + dmeventd.service + dmeventd.socket + lvm-monitoring.service + lvmetad.service + lvmetad.socket) sha1sums=('077425115b164c335a9930df745943e9ea666a8a' '4713c852fc668e6fbd36ff7c6b5675b10a95a0f8' - '3e1680f9b76ce9150d08865d99db90fd15532271' - 'cedc9948123c870f9c5aa3357d0075b41a9c8135' + '8008547b133af89f79461a6df5412539ed3f26b7' + 'ff0fdf0a3005a41acd4b36865056109effc3474b' 'f6a554eea9557c3c236df2943bb6e7e723945c41' - 'edce6b6e8d03f7cbad4bfff49fab01d618415be8' - '652fb58dd7676caa0515f0a06d537744e071c6cf' - 'ccefad65fde3d50331a42b0e90a1539dc7c8b9e4') + 'ccefad65fde3d50331a42b0e90a1539dc7c8b9e4' + 'cbc64f377fbb1c1a9ff53bc6ca85c324075499b7' + '1d56f47a81350ae37ffbf61ee036fe31f4c5d504' + 'ae945cae2d71b286439a9945876acb78dc9eeaf7' + '460b094e8689298ed59842d1abcee5d4e706e1d7' + 'fcfc265e3b10294cc4b10949a342e9db4310b186') build() { cd "${srcdir}/LVM2.${pkgver}" unset LDFLAGS - ./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 + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-udev-prefix=/usr \ + --with-systemdsystemunitdir=/usr/lib/systemd/system --with-default-pid-dir=/run \ + --with-default-dm-run-dir=/run --with-default-run-dir=/run/lvm \ + --enable-pkgconfig --enable-readline --enable-dmeventd --enable-cmdlib --enable-applib \ + --enable-udev_sync --enable-udev_rules --with-default-locking-dir=/run/lock/lvm \ + --enable-lvmetad make } @@ -47,6 +54,11 @@ package_device-mapper() { 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 + install -D -m644 "${srcdir}/dmeventd.service" "${pkgdir}/usr/lib/systemd/system/dmeventd.service" + install -D -m644 "${srcdir}/dmeventd.socket" "${pkgdir}/usr/lib/systemd/system/dmeventd.socket" + install -d -m755 "${pkgdir}/usr/lib/systemd/system/sockets.target.wants" + ln -sf /usr/lib/systemd/system/dmeventd.socket "${pkgdir}/usr/lib/systemd/system/sockets.target.wants/dmeventd.socket" } package_lvm2() { @@ -55,6 +67,7 @@ package_lvm2() { conflicts=('lvm' 'mkinitcpio<0.7') backup=('etc/lvm/lvm.conf') options=('!makeflags') + install=lvm2.install cd "${srcdir}/LVM2.${pkgver}" make DESTDIR="${pkgdir}" install_lvm2 @@ -66,7 +79,12 @@ package_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}/lvm-on-crypt.service" "${pkgdir}/usr/lib/systemd/system/lvm-on-crypt.service" install -D -m644 "${srcdir}/lvm2.conf" "${pkgdir}/usr/lib/tmpfiles.d/lvm2.conf" + install -D -m644 "${srcdir}/lvm-monitoring.service" "${pkgdir}/usr/lib/systemd/system/lvm-monitoring.service" + install -D -m644 "${srcdir}/lvmetad.service" "${pkgdir}/usr/lib/systemd/system/lvmetad.service" + install -D -m644 "${srcdir}/lvmetad.socket" "${pkgdir}/usr/lib/systemd/system/lvmetad.socket" + install -d -m755 "${pkgdir}/usr/lib/systemd/system/sockets.target.wants" + ln -sf /usr/lib/systemd/system/lvmetad.socket "${pkgdir}/usr/lib/systemd/system/sockets.target.wants/lvmetad.socket" + # enable lvmetad + sed 's|use_lvmetad = 0|use_lvmetad = 1|' -i "${pkgdir}/etc/lvm/lvm.conf" } diff --git a/core/lvm2/dmeventd.service b/core/lvm2/dmeventd.service new file mode 100644 index 000000000..15ca21c0b --- /dev/null +++ b/core/lvm2/dmeventd.service @@ -0,0 +1,14 @@ +[Unit] +Description=Device-mapper event daemon +Documentation=man:dmeventd(8) +Requires=dmeventd.socket +After=dmeventd.socket +DefaultDependencies=no + +[Service] +Type=forking +ExecStart=/usr/sbin/dmeventd +ExecReload=/usr/sbin/dmeventd -R +Environment=SD_ACTIVATION=1 +PIDFile=/run/dmeventd.pid +OOMScoreAdjust=-1000 diff --git a/core/lvm2/dmeventd.socket b/core/lvm2/dmeventd.socket new file mode 100644 index 000000000..726d11236 --- /dev/null +++ b/core/lvm2/dmeventd.socket @@ -0,0 +1,11 @@ +[Unit] +Description=Device-mapper event daemon FIFOs +Documentation=man:dmeventd(8) +Before=sockets.target +DefaultDependencies=no +Conflicts=shutdown.target + +[Socket] +ListenFIFO=/run/dmeventd-server +ListenFIFO=/run/dmeventd-client +SocketMode=0600 diff --git a/core/lvm2/lvm-monitoring.service b/core/lvm2/lvm-monitoring.service new file mode 100644 index 000000000..8f5247b00 --- /dev/null +++ b/core/lvm2/lvm-monitoring.service @@ -0,0 +1,18 @@ +[Unit] +Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling +Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8) +Requires=dmeventd.socket +After=dmeventd.socket lvmetad.socket lvmetad.service dmeventd.service +Before=local-fs-pre.target +DefaultDependencies=no +Conflicts=shutdown.target + +[Service] +Type=oneshot +Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 +ExecStart=/usr/sbin/lvm vgchange --monitor y +ExecStop=/usr/sbin/lvm vgchange --monitor n +RemainAfterExit=yes + +[Install] +WantedBy=sysinit.target diff --git a/core/lvm2/lvm-on-crypt.service b/core/lvm2/lvm-on-crypt.service deleted file mode 100644 index 346c5ac8e..000000000 --- a/core/lvm2/lvm-on-crypt.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=LVM activation of encrypted devices -DefaultDependencies=no -Requires=systemd-udev-settle.service -After=systemd-udev-settle.service cryptsetup.target -Before=shutdown.target -Conflicts=shutdown.target - -[Service] -ExecStart=/sbin/vgchange --available y -Type=oneshot -TimeoutSec=0 -RemainAfterExit=yes - -[Install] -WantedBy=basic.target diff --git a/core/lvm2/lvm.service b/core/lvm2/lvm.service deleted file mode 100644 index 14269b1be..000000000 --- a/core/lvm2/lvm.service +++ /dev/null @@ -1,16 +0,0 @@ -[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 --available y -Type=oneshot -TimeoutSec=0 -RemainAfterExit=yes - -[Install] -WantedBy=basic.target diff --git a/core/lvm2/lvm2.install b/core/lvm2/lvm2.install new file mode 100644 index 000000000..7faf708d4 --- /dev/null +++ b/core/lvm2/lvm2.install @@ -0,0 +1,16 @@ +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 +} + +# vim:set ts=2 sw=2 et: diff --git a/core/lvm2/lvm2_hook b/core/lvm2/lvm2_hook index e69b3349a..65de7bd2f 100644 --- a/core/lvm2/lvm2_hook +++ b/core/lvm2/lvm2_hook @@ -1,24 +1,12 @@ #!/usr/bin/ash -run_hook() { - local pvdev - - modprobe -q dm-mod >/dev/null 2>&1 - - # 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 +run_earlyhook() { + mkdir /run/lvm + lvmetad +} - if [ -n "$quiet" ]; then - lvm vgchange --sysinit -a y >/dev/null - else - lvm vgchange --sysinit -a y - fi +run_cleanuphook() { + kill $(cat /run/lvmetad.pid) } # vim: set ft=sh ts=4 sw=4 et: diff --git a/core/lvm2/lvm2_install b/core/lvm2/lvm2_install index 145ce49b2..be27614bd 100644 --- a/core/lvm2/lvm2_install +++ b/core/lvm2/lvm2_install @@ -6,25 +6,23 @@ build() { add_module "$mod" done - add_binary "/sbin/lvm" - add_binary "/sbin/dmsetup" + add_binary "/usr/sbin/lvm" + add_binary "/usr/sbin/lvmetad" + add_binary "/usr/sbin/dmsetup" 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/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 "/etc/lvm/lvm.conf" add_runscript } 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. +This hook enables LVM2 volumes in initramfs. HELPEOF } diff --git a/core/lvm2/lvmetad.service b/core/lvm2/lvmetad.service new file mode 100644 index 000000000..64168f465 --- /dev/null +++ b/core/lvm2/lvmetad.service @@ -0,0 +1,16 @@ +[Unit] +Description=LVM2 metadata daemon +Documentation=man:lvmetad(8) +Requires=lvmetad.socket +After=lvmetad.socket +DefaultDependencies=no +Conflicts=shutdown.target + +[Service] +Type=forking +NonBlocking=true +ExecStart=/usr/sbin/lvmetad +ExecReload=/usr/sbin/lvmetad -R +Environment=SD_ACTIVATION=1 +Restart=on-abort +PIDFile=/run/lvmetad.pid diff --git a/core/lvm2/lvmetad.socket b/core/lvm2/lvmetad.socket new file mode 100644 index 000000000..9c0ffa5b4 --- /dev/null +++ b/core/lvm2/lvmetad.socket @@ -0,0 +1,10 @@ +[Unit] +Description=LVM2 metadata daemon socket +Documentation=man:lvmetad(8) +Before=sockets.target systemd-udev-trigger.service +DefaultDependencies=no +Conflicts=shutdown.target + +[Socket] +ListenStream=/run/lvm/lvmetad.socket +SocketMode=0600 |