# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-fs/dmraid/dmraid-1.0.0_rc15-r1.ebuild,v 1.1 2009/09/09 21:02:11 tommy Exp $ inherit linux-info flag-o-matic linux-mod MY_PV=${PV/_/.} DESCRIPTION="Device-mapper RAID tool and library" HOMEPAGE="http://people.redhat.com/~heinzm/sw/dmraid/" SRC_URI="http://people.redhat.com/~heinzm/sw/dmraid/src/${PN}-${MY_PV}.tar.bz2 http://omploader.org/vMmNwdQ/${PN}-${MY_PV}-raid45.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~ppc ~x86" IUSE="raid45 static selinux" RDEPEND="|| ( >=sys-fs/lvm2-2.02.45 sys-fs/device-mapper ) selinux? ( sys-libs/libselinux sys-libs/libsepol )" DEPEND="${RDEPEND} raid45? ( >=sys-kernel/gentoo-sources-2.6.29 )" S=${WORKDIR}/${PN}/${MY_PV} if use raid45; then CONFIG_CHECK="BLK_DEV_DM EXPERIMENTAL ASYNC_XOR" ERROR_BLK_DEV_DM="dm-raid45 requires Device-Mapper Support (CONFIG_BLK_DEV_DM)" ERROR_EXPERIMENTAL="dm-raid45 is experimental and requires the Experimental flag (CONFIG_EXPERIMENTAL)" ERROR_ASYNC_XOR="dm-raid45 requires Asynchronos XOR support (CONFIG_ASYNC_XOR)" fi pkg_setup() { if use raid45; then ewarn "WARNING - dm-raid45 is ALPHA software and it can destroy your data!" linux-mod_pkg_setup MODULE_NAMES="dm-raid45(drivers/md:${S}/kmod:${S}/kmod)" BUILD_PARAMS="KDIR=${KV_OUT_DIR} KERNEL_DIR=${KV_DIR}" # patch the kernel here if ! grep -qs "EXPORT_SYMBOL_GPL(dm_disk);" "${KV_DIR}/drivers/md/dm.c"; then ewarn "Patching your kernel..." cd "${KV_DIR}" if kernel_is ge 2 6 31; then eerror "dm-raid45 has not been ported to 2.6.31 yet" else epatch "${FILESDIR}"/${P}-raid45-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.patch fi fi else if kernel_is lt 2 6; then ewarn "You are using a kernel < 2.6" ewarn "DMraid uses recently introduced Device-Mapper features." ewarn "These might be unavailable in the kernel you are running now." fi fi if use static && use selinux ; then eerror "ERROR - cannot compile static with libselinux / libsepol" die "USE flag conflicts." fi } src_unpack() { unpack ${A} # apply patches to dmraid source cd "${S}" epatch "${FILESDIR}/${P}-devsk-isw.patch" epatch "${FILESDIR}/${P}-undo-p-rename.patch" # archive the patched source for use with genkernel cd "${WORKDIR}" tar -jcf ${PN}-${MY_PV}-prepatched.tar.bz2 ${PN} # patch the build system cd "${S}" epatch "${FILESDIR}/${PN}-destdir-fix.patch" } src_compile() { econf \ $(use_enable static static_link) \ $(use_enable selinux libselinux) \ $(use_enable selinux libsepol) emake -j1 || die "emake failed" if use raid45; then linux-mod_src_compile fi } src_install() { emake DESTDIR="${D}" install || die "emake install failed" dodoc CHANGELOG README TODO KNOWN_BUGS doc/* || die "dodoc failed" insinto /usr/share/${PN} cd "${WORKDIR}" doins ${PN}-${MY_PV}-prepatched.tar.bz2 || die if use raid45; then linux-mod_src_install fi } pkg_postinst() { if use raid45; then local moddir="${ROOT}/lib/modules/${KV_FULL}/drivers/md/" linux-mod_pkg_postinst elog "kernel module dm-raid45 installed." ewarn "Your Kernel Source Has Been Patched!" ewarn "Remember to re-emerge this module any time you recompile your kernel!" elog " " fi elog "For booting Gentoo from Device-Mapper RAID you can use Genkernel." elog " " elog "Genkernel will generate the kernel and the initrd with a statically " elog "linked dmraid binary (its own version which may not be the same as this version):" elog "\t emerge -av sys-kernel/genkernel" elog "\t genkernel --dmraid all" elog " " elog "If you would rather use this version of DMRAID with Genkernel, update the following" elog "in /etc/genkernel.conf:" elog "\t DMRAID_VER=\"${MY_PV}\"" elog "\t DMRAID_SRCTAR=\"/usr/share/${PN}/${PN}-${MY_PV}-prepatched.tar.bz2\"" elog " " ewarn "DMRAID should be safe to use, but no warranties can be given" }