summaryrefslogtreecommitdiff
blob: 29cb3b975f5e37a040c3bd72270d71eef8055827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/dracut-004.ebuild,v 1.1 2010/02/02 16:32:32 ramereth Exp $

EAPI=2

inherit mount-boot

DESCRIPTION="Generic initramfs generation tool"
HOMEPAGE="http://sourceforge.net/projects/dracut/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="crypt dmraid iscsi lvm nbd nfs md selinux"

# common networking deps
NETWORK_DEPS="sys-apps/iproute2 net-misc/dhcp net-misc/bridge-utils"

RDEPEND="app-shells/dash
	>=sys-apps/module-init-tools-3.6
	>=sys-apps/util-linux-2.16
	crypt? ( sys-fs/cryptsetup )
	dmraid? ( sys-fs/dmraid )
	lvm? ( >=sys-fs/lvm2-2.02.33 )
	md? ( sys-fs/mdadm )
	nfs? ( net-fs/nfs-utils net-nds/rpcbind ${NETWORK_DEPS} )
	iscsi? ( sys-block/open-iscsi[utils] ${NETWORK_DEPS} )
	nbd? ( sys-block/nbd ${NETWORK_DEPS} )
	selinux? ( sys-libs/libselinux sys-libs/libsepol )"
DEPEND="${RDEPEND}"

src_compile() {
	emake WITH_SWITCH_ROOT=0 prefix=/usr sysconfdir=/etc || die "emake failed"
}

src_install() {
	local modules_dir="${D}/usr/share/dracut/modules.d"

	emake WITH_SWITCH_ROOT=0 \
		prefix=/usr sysconfdir=/etc \
		DESTDIR="${D}" install || die "emake install failed"
	echo "${PF}" > "${modules_dir}"/10rpmversion/dracut-version
	dodir /boot/dracut /var/lib/dracut/overlay
	dodoc HACKING TODO AUTHORS NEWS README*
	# disable modules not enabled by use flags
	for module in crypt dmraid lvm md ; do
		! use ${module} && rm -rf ${modules_dir}/90${module}
	done
	# disable all network modules
	for module in iscsi nbd nfs ; do
		! use ${module} && rm -rf ${modules_dir}/95${module}
	done
	# if no networking at all, disable the rest
	if ! use iscsi && ! use nbd && ! use nfs ; then
		rm -rf ${modules_dir}/40network
		rm -rf ${modules_dir}/95fcoe
	fi
}

pkg_postinst() {
	elog 'To generate the initramfs:'
	elog ' # mount /boot (if necessary)'
	elog ' # dracut "" <kernel-version>'
	elog ''
	elog 'For command line documentation, see:'
	elog 'http://sourceforge.net/apps/trac/dracut/wiki/commandline'
	elog ''
	elog 'Simple example to select root and resume partition:'
	elog ' root=/dev/???? resume=/dev/????'
	elog ''
	elog 'Configuration is in /etc/dracut.conf.'
	elog 'The default config is very minimal and is highly recommended you'
	elog 'adjust based on your needs. To include only drivers for this system,'
	elog 'use the "-H" option.'
}