33644346fda818b2b09016ced549510787ecd048
[gentoo.git] / sys-fs / multipath-tools / multipath-tools-0.5.0-r1.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=4
6 inherit eutils systemd toolchain-funcs udev
7
8 DESCRIPTION="Device mapper target autoconfig"
9 HOMEPAGE="http://christophe.varoqui.free.fr/"
10 SRC_URI="http://christophe.varoqui.free.fr/${PN}/${P}.tar.bz2"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 ~arm ~ia64 ppc ppc64 ~sparc x86"
15 IUSE="systemd"
16
17 RDEPEND=">=sys-fs/lvm2-2.02.45
18         >=virtual/udev-171
19         dev-libs/libaio
20         sys-libs/readline
21         systemd? ( sys-apps/systemd )"
22 DEPEND="${RDEPEND}
23         virtual/pkgconfig"
24
25 src_prepare() {
26         epatch "${FILESDIR}"/${P}-makefile.patch
27         epatch "${FILESDIR}"/${P}-systemd-pkgconfig.patch
28         epatch_user
29 }
30
31 src_compile() {
32         # LIBDM_API_FLUSH involves grepping files in /usr/include,
33         # so force the test to go the way we want #411337.
34         emake LIBDM_API_FLUSH=1 CC="$(tc-getCC)" SYSTEMD=$(usex systemd 1 "")
35 }
36
37 src_install() {
38         local udevdir="$(get_udevdir)"
39
40         dodir /sbin /usr/share/man/man8
41         emake \
42                 DESTDIR="${D}" \
43                 SYSTEMD=$(usex systemd 1 "") \
44                 unitdir="$(systemd_get_unitdir)" \
45                 libudevdir='${prefix}'/"${udevdir}" \
46                 install
47
48         insinto /etc
49         newins "${S}"/multipath.conf.annotated multipath.conf
50         # /etc/udev is reserved for user modified rules!
51         mv "${D}"/etc/udev/rules.d "${D}/${udevdir}"/ || die
52         fperms 644 "${udevdir}"/rules.d/66-kpartx.rules
53         newinitd "${FILESDIR}"/rc-multipathd multipathd
54         newinitd "${FILESDIR}"/multipath.rc multipath
55
56         dodoc multipath.conf.* AUTHOR ChangeLog FAQ
57         docinto kpartx
58         dodoc kpartx/ChangeLog kpartx/README
59 }
60
61 pkg_postinst() {
62         if [[ -z ${REPLACING_VERSIONS} ]]; then
63                 elog "If you need multipath on your system, you must"
64                 elog "add 'multipath' into your boot runlevel!"
65         fi
66 }