# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 TMPFILES_OPTIONAL=1 inherit autotools linux-info systemd toolchain-funcs tmpfiles udev flag-o-matic DESCRIPTION="User-land utilities for LVM2 (device-mapper) software" HOMEPAGE="https://sourceware.org/lvm2/" SRC_URI="https://sourceware.org/ftp/lvm2/${PN^^}.${PV}.tgz" S="${WORKDIR}/${PN^^}.${PV}" LICENSE="GPL-2" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" IUSE="lvm readline sanlock selinux static static-libs systemd thin +udev valgrind" REQUIRED_USE=" static? ( !systemd !udev ) static-libs? ( static !udev ) systemd? ( udev ) thin? ( lvm ) " DEPEND_COMMON=" udev? ( virtual/libudev:= ) lvm? ( dev-libs/libaio sys-apps/util-linux readline? ( sys-libs/readline:= ) sanlock? ( sys-cluster/sanlock ) systemd? ( sys-apps/systemd:= ) ) " # /run is now required for locking during early boot. /var cannot be assumed to # be available -- thus, pull in recent enough baselayout for /run. # This version of LVM is incompatible with cryptsetup <1.1.2. RDEPEND=" ${DEPEND_COMMON} >=sys-apps/baselayout-2.2 lvm? ( virtual/tmpfiles thin? ( //g' \ "${ED}"/etc/conf.d/lvm || die "Could not drop udev from rc_need" fi newinitd "${FILESDIR}"/lvm-monitoring.initd-r3 lvm-monitoring newinitd "${FILESDIR}"/lvmpolld.initd-r1 lvmpolld if use sanlock; then newinitd "${FILESDIR}"/lvmlockd.initd-r2 lvmlockd fi fi if use static-libs; then dolib.a libdm/ioctl/libdevmapper.a if use lvm; then # depends on lvmetad dolib.a libdaemon/client/libdaemonclient.a #462908 # depends on dmeventd dolib.a daemons/dmeventd/libdevmapper-event.a fi else rm -f "${ED}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a || die fi insinto /etc doins "${FILESDIR}"/dmtab dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf } pkg_preinst() { HAD_LVM=0 if has_version 'sys-fs/lvm2[lvm(+)]' ; then HAD_LVM=1 fi } pkg_postinst() { use lvm && tmpfiles_process lvm2.conf use udev && udev_reload # This is a new installation if [[ -z "${REPLACING_VERSIONS}" ]]; then if use lvm ; then ewarn "Make sure the \"lvm\" init script is in the runlevels:" ewarn "# rc-update add lvm boot" ewarn ewarn "Make sure to enable lvmetad in ${EROOT}/etc/lvm/lvm.conf if you want" ewarn "to enable lvm autoactivation and metadata caching." else ewarn "Please enable USE=lvm if you need the LVM daemon and" ewarn "tools like 'lvchange', 'vgchange', etc!" fi else if ! use lvm && [[ ${HAD_LVM} -eq 1 ]] ; then ewarn "LVM was previously enabled but is now disabled." ewarn "Please enable USE=lvm if you need the LVM daemon and" ewarn "tools like 'lvchange', 'vgchange', etc!" ewarn "See the 2022-11-19-lvm2-default-USE-flags news item for more details." fi fi if use udev && [[ -d /run ]] ; then local permission_run_expected="drwxr-xr-x" local permission_run=$(stat -c "%A" /run) if [[ "${permission_run}" != "${permission_run_expected}" ]] ; then ewarn "Found the following problematic permissions:" ewarn "" ewarn " ${permission_run} /run" ewarn "" ewarn "Expected:" ewarn "" ewarn " ${permission_run_expected} /run" ewarn "" ewarn "This is known to cause problems for udev-enabled LVM services." fi fi } pkg_postrm() { if use udev && [[ -z ${REPLACED_BY_VERSION} ]]; then udev_reload fi }