--- lvm2-2.02.98.ebuild 2013-01-18 04:01:30.000000000 +0000 +++ lvm2-2.02.98-r1.ebuild 2013-01-30 19:36:10.006348717 +0000 @@ -3,7 +3,7 @@ # $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/lvm2-2.02.98.ebuild,v 1.3 2013/01/18 03:39:06 ssuominen Exp $ EAPI=5 -inherit eutils multilib toolchain-funcs autotools linux-info udev +inherit eutils multilib toolchain-funcs autotools linux-info systemd udev DESCRIPTION="User-land utilities for LVM2 (device-mapper) software." HOMEPAGE="http://sources.redhat.com/lvm2/" @@ -14,7 +14,7 @@ SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux" -IUSE="readline static static-libs clvm cman +lvm1 selinux +udev +thin" +IUSE="readline static static-libs clvm cman +lvm1 lvmetad selinux systemd +udev +thin" DEPEND_COMMON="!!sys-fs/device-mapper readline? ( sys-libs/readline ) @@ -110,6 +110,10 @@ tools/Makefile.in || die "sed failed" fi + # gentoo has lvm installed in /sbin + sed -i 's:/usr/sbin/lvm:/sbin/lvm:' \ + scripts/lvm2_activation_generator_systemd_red_hat.c || die "sed failed" + eautoreconf } @@ -177,6 +181,13 @@ myconf="${myconf} --with-clvmd=none --with-cluster=none" fi + # better to just force the unit dir + if use systemd; then + myconf="${myconf} --with-systemdsystemunitdir=$(systemd_get_unitdir)" + fi + # and also change the default pid directory to /run instead of /var/run + myconf="${myconf} --with-default-pid-dir=/run" + local udevdir="${EPREFIX}/lib/udev/rules.d" use udev && udevdir="${EPREFIX}/$(udev_get_udevdir)/rules.d" @@ -207,11 +218,33 @@ einfo "Starting main build" emake AR="$(tc-getAR)" || die "compile fail" + + # with systemd USE enabled but without lvmetad + # a generator is needed for systemd to create /dev nodes + # note: this should be already build, but I am not sure + # if this is always, or just sometimes + use lvmetad || use systemd && emake -C scripts lvm2_activation_generator_systemd_red_hat } src_install() { emake DESTDIR="${D}" install + # install systemd files + if use systemd ; then + # install either the lvmetad and lvm units + # or the lvm systemd unit generator + use lvmetad && emake DESTDIR="${D}" install_systemd_units + use lvmetad || emake DESTDIR="${D}" install_systemd_generators + fi + + # change the default to use lvmetad. Only for systemd for now + # since lvmetad misses an openrc initscript + # this is needed because with both USE flag set systemd generator + # is not installed, hence systemd needs another way to have + # /dev nodes created + use lvmetad && use systemd && \ + sed -i 's: use_lvmetad = 0: use_lvmetad = 1:' "${D}"/etc/lvm/lvm.conf + dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{conf,c,txt} newinitd "${FILESDIR}"/lvm.rc-2.02.95-r2 lvm newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.67-r2 lvm-monitoring @@ -270,6 +303,14 @@ elog "baselayout-2 users. If you are using baselayout-2, be sure to" elog "run: # rc-update add lvm boot" elog "Do NOT add it if you are still using baselayout-1." + + if use lvmetad && use systemd ; then + ewarn "You enabled lvmetad and systemd USE flag" + ewarn "Be sure to enabled use_lvmetad in /etc/lvm/lvm.conf" + ewarn "Failure to do so will probably turn in systemd" + ewarn "failing to boot, not finding a lvm /dev node" + ewarn "More info can be found in lvmetad and lvm.conf man pages" + fi } src_test() {