| 1 |
aidecoe |
1.1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
aidecoe |
1.3 |
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/dracut-022.ebuild,v 1.2 2012/07/26 18:01:05 aidecoe Exp $
|
| 4 |
aidecoe |
1.1 |
|
| 5 |
|
|
EAPI=4
|
| 6 |
|
|
|
| 7 |
|
|
inherit eutils linux-info
|
| 8 |
|
|
|
| 9 |
|
|
add_req_use_for() {
|
| 10 |
|
|
local dep="$1"; shift
|
| 11 |
|
|
local f
|
| 12 |
|
|
|
| 13 |
|
|
for f in "$@"; do
|
| 14 |
|
|
REQUIRED_USE+="${f}? ( ${dep} )
|
| 15 |
|
|
"
|
| 16 |
|
|
done
|
| 17 |
|
|
}
|
| 18 |
|
|
|
| 19 |
|
|
DESCRIPTION="Generic initramfs generation tool"
|
| 20 |
|
|
HOMEPAGE="http://dracut.wiki.kernel.org"
|
| 21 |
|
|
SRC_URI="mirror://kernel/linux/utils/boot/${PN}/${P}.tar.bz2"
|
| 22 |
|
|
LICENSE="GPL-2"
|
| 23 |
|
|
SLOT="0"
|
| 24 |
|
|
KEYWORDS="~amd64 ~x86"
|
| 25 |
|
|
|
| 26 |
|
|
REQUIRED_USE="dracut_modules_crypt-gpg? ( dracut_modules_crypt )
|
| 27 |
|
|
dracut_modules_livenet? ( dracut_modules_dmsquash-live )
|
| 28 |
|
|
"
|
| 29 |
|
|
COMMON_MODULES="
|
| 30 |
|
|
dracut_modules_biosdevname
|
| 31 |
|
|
dracut_modules_bootchart
|
| 32 |
|
|
dracut_modules_btrfs
|
| 33 |
|
|
dracut_modules_caps
|
| 34 |
|
|
dracut_modules_crypt-gpg
|
| 35 |
|
|
dracut_modules_gensplash
|
| 36 |
|
|
dracut_modules_mdraid
|
| 37 |
|
|
dracut_modules_multipath
|
| 38 |
|
|
dracut_modules_plymouth
|
| 39 |
|
|
dracut_modules_syslog
|
| 40 |
|
|
"
|
| 41 |
|
|
DM_MODULES="
|
| 42 |
|
|
dracut_modules_crypt
|
| 43 |
|
|
dracut_modules_dmraid
|
| 44 |
|
|
dracut_modules_dmsquash-live
|
| 45 |
|
|
dracut_modules_livenet
|
| 46 |
|
|
dracut_modules_lvm
|
| 47 |
|
|
"
|
| 48 |
|
|
NETWORK_MODULES="
|
| 49 |
|
|
dracut_modules_iscsi
|
| 50 |
|
|
dracut_modules_livenet
|
| 51 |
|
|
dracut_modules_nbd
|
| 52 |
|
|
dracut_modules_nfs
|
| 53 |
|
|
dracut_modules_ssh-client
|
| 54 |
|
|
"
|
| 55 |
|
|
add_req_use_for device-mapper ${DM_MODULES}
|
| 56 |
|
|
add_req_use_for net ${NETWORK_MODULES}
|
| 57 |
|
|
IUSE_DRACUT_MODULES="${COMMON_MODULES} ${DM_MODULES} ${NETWORK_MODULES}"
|
| 58 |
|
|
IUSE="debug device-mapper +optimization net selinux ${IUSE_DRACUT_MODULES}"
|
| 59 |
|
|
|
| 60 |
|
|
RESTRICT="test"
|
| 61 |
|
|
|
| 62 |
|
|
RDEPEND="
|
| 63 |
|
|
app-arch/cpio
|
| 64 |
|
|
>=app-shells/bash-4.0
|
| 65 |
|
|
>=app-shells/dash-0.5.4.11
|
| 66 |
|
|
>=sys-apps/baselayout-1.12.14-r1
|
| 67 |
|
|
|| ( >=sys-apps/module-init-tools-3.8 >sys-apps/kmod-5[tools] )
|
| 68 |
|
|
>=sys-apps/sysvinit-2.87-r3
|
| 69 |
|
|
>=sys-apps/util-linux-2.20
|
| 70 |
|
|
>=sys-fs/udev-166
|
| 71 |
|
|
|
| 72 |
|
|
debug? ( dev-util/strace )
|
| 73 |
|
|
device-mapper? ( || ( sys-fs/device-mapper >=sys-fs/lvm2-2.02.33 ) )
|
| 74 |
|
|
net? ( net-misc/curl >=net-misc/dhcp-4.2.1-r1 sys-apps/iproute2 )
|
| 75 |
|
|
selinux? ( sys-libs/libselinux sys-libs/libsepol )
|
| 76 |
|
|
dracut_modules_biosdevname? ( sys-apps/biosdevname )
|
| 77 |
|
|
dracut_modules_bootchart? ( app-benchmarks/bootchart2 )
|
| 78 |
|
|
dracut_modules_btrfs? ( sys-fs/btrfs-progs )
|
| 79 |
|
|
dracut_modules_caps? ( sys-libs/libcap )
|
| 80 |
|
|
dracut_modules_crypt? ( sys-fs/cryptsetup )
|
| 81 |
|
|
dracut_modules_crypt-gpg? ( app-crypt/gnupg )
|
| 82 |
|
|
dracut_modules_dmraid? ( sys-fs/dmraid sys-fs/multipath-tools )
|
| 83 |
|
|
dracut_modules_gensplash? ( media-gfx/splashutils )
|
| 84 |
|
|
dracut_modules_iscsi? ( >=sys-block/open-iscsi-2.0.871.3 )
|
| 85 |
|
|
dracut_modules_lvm? ( >=sys-fs/lvm2-2.02.33 )
|
| 86 |
|
|
dracut_modules_mdraid? ( sys-fs/mdadm )
|
| 87 |
|
|
dracut_modules_multipath? ( sys-fs/multipath-tools )
|
| 88 |
|
|
dracut_modules_nbd? ( sys-block/nbd )
|
| 89 |
|
|
dracut_modules_nfs? ( net-fs/nfs-utils net-nds/rpcbind )
|
| 90 |
|
|
dracut_modules_plymouth? ( >=sys-boot/plymouth-0.8.3-r1 )
|
| 91 |
|
|
dracut_modules_ssh-client? ( dev-libs/openssl )
|
| 92 |
|
|
dracut_modules_syslog? ( || ( app-admin/syslog-ng app-admin/rsyslog ) )
|
| 93 |
|
|
"
|
| 94 |
aidecoe |
1.2 |
DEPEND="
|
| 95 |
|
|
app-text/asciidoc
|
| 96 |
|
|
>=dev-libs/libxslt-1.1.26
|
| 97 |
|
|
app-text/docbook-xml-dtd:4.5
|
| 98 |
|
|
>=app-text/docbook-xsl-stylesheets-1.75.2
|
| 99 |
|
|
"
|
| 100 |
aidecoe |
1.1 |
|
| 101 |
|
|
#
|
| 102 |
|
|
# Helper functions
|
| 103 |
|
|
#
|
| 104 |
|
|
|
| 105 |
|
|
# Returns true if any of specified modules is enabled by USE flag and false
|
| 106 |
|
|
# otherwise.
|
| 107 |
|
|
# $1 = list of modules (which have corresponding USE flags of the same name)
|
| 108 |
|
|
any_module() {
|
| 109 |
|
|
local m modules=" $@ "
|
| 110 |
|
|
|
| 111 |
|
|
for m in ${modules}; do
|
| 112 |
|
|
! use $m && modules=${modules/ $m / }
|
| 113 |
|
|
done
|
| 114 |
|
|
|
| 115 |
|
|
shopt -s extglob
|
| 116 |
|
|
modules=${modules%%+( )}
|
| 117 |
|
|
shopt -u extglob
|
| 118 |
|
|
|
| 119 |
|
|
[[ ${modules} ]]
|
| 120 |
|
|
}
|
| 121 |
|
|
|
| 122 |
|
|
# Removes module from modules.d.
|
| 123 |
|
|
# $1 = module name
|
| 124 |
|
|
# Module name can be specified without number prefix.
|
| 125 |
|
|
rm_module() {
|
| 126 |
|
|
local force m
|
| 127 |
|
|
[[ $1 = -f ]] && force=-f
|
| 128 |
|
|
|
| 129 |
|
|
for m in $@; do
|
| 130 |
|
|
if [[ $m =~ ^[0-9][0-9][^\ ]*$ ]]; then
|
| 131 |
|
|
rm ${force} --interactive=never -r "${modules_dir}"/$m
|
| 132 |
|
|
else
|
| 133 |
|
|
rm ${force} --interactive=never -r "${modules_dir}"/[0-9][0-9]$m
|
| 134 |
|
|
fi
|
| 135 |
|
|
done
|
| 136 |
|
|
}
|
| 137 |
|
|
|
| 138 |
|
|
#
|
| 139 |
|
|
# ebuild functions
|
| 140 |
|
|
#
|
| 141 |
|
|
|
| 142 |
|
|
src_prepare() {
|
| 143 |
|
|
epatch "${FILESDIR}/${PV}-0001-qemu-module-setup.sh-provide-alternati.patch"
|
| 144 |
|
|
epatch "${FILESDIR}/${PV}-0002-Makefile-use-implicit-rules-for-instal.patch"
|
| 145 |
|
|
epatch "${FILESDIR}/${PV}-0003-kernel-modules-module-setup.sh-just-op.patch"
|
| 146 |
|
|
epatch "${FILESDIR}/${PV}-0004-90multipath-added-kpartx.rules-multipa.patch"
|
| 147 |
|
|
epatch "${FILESDIR}/${PV}-0005-gentoo.conf-set-udevdir.patch"
|
| 148 |
|
|
epatch "${FILESDIR}/${PV}-0006-Config-file-for-systemd-on-Gentoo.patch"
|
| 149 |
|
|
epatch "${FILESDIR}/${PV}-0007-Remove-obsolete-gentoo-conf-file.patch"
|
| 150 |
|
|
epatch "${FILESDIR}/${PV}-0008-95rootfs-block-fix-left-fsck-rel.-chec.patch"
|
| 151 |
|
|
epatch "${FILESDIR}/${PV}-0009-98usrmount-use-rw-and-ro-options-inste.patch"
|
| 152 |
|
|
epatch "${FILESDIR}/${PV}-0010-98usrmount-print-mount-options.patch"
|
| 153 |
|
|
epatch "${FILESDIR}/${PV}-0011-dracut-lib-new-functions-listlist-and-.patch"
|
| 154 |
|
|
epatch "${FILESDIR}/${PV}-0012-apply-ro-and-rw-options-from-cmdline-t.patch"
|
| 155 |
|
|
epatch "${FILESDIR}/${PV}-0013-ro_mnt-option-at-build-time-to-force-r.patch"
|
| 156 |
|
|
epatch "${FILESDIR}/${PV}-0014-parse-root-opts-first-check-for-ro-lat.patch"
|
| 157 |
|
|
epatch "${FILESDIR}/${PV}-0015-gentoo.conf-enable-ro_mnt.patch"
|
| 158 |
aidecoe |
1.3 |
einfo "Removing ${S}/install/hashmap.o ..."
|
| 159 |
|
|
rm "${S}/install/hashmap.o" || die
|
| 160 |
aidecoe |
1.1 |
}
|
| 161 |
|
|
|
| 162 |
|
|
src_compile() {
|
| 163 |
|
|
if use optimization; then
|
| 164 |
aidecoe |
1.2 |
emake prefix=/usr sysconfdir=/etc DESTDIR="${D}" doc \
|
| 165 |
|
|
install/dracut-install
|
| 166 |
aidecoe |
1.1 |
fi
|
| 167 |
|
|
}
|
| 168 |
|
|
|
| 169 |
|
|
src_install() {
|
| 170 |
|
|
emake prefix=/usr sysconfdir=/etc DESTDIR="${D}" install
|
| 171 |
|
|
|
| 172 |
|
|
dodir /var/lib/dracut/overlay
|
| 173 |
|
|
dodoc HACKING TODO AUTHORS NEWS README*
|
| 174 |
|
|
|
| 175 |
|
|
insinto /etc/dracut.conf.d
|
| 176 |
|
|
newins dracut.conf.d/gentoo.conf.example gentoo.conf
|
| 177 |
|
|
|
| 178 |
|
|
insinto /etc/logrotate.d
|
| 179 |
|
|
newins dracut.logrotate dracut
|
| 180 |
|
|
|
| 181 |
|
|
dohtml dracut.html
|
| 182 |
|
|
|
| 183 |
|
|
#
|
| 184 |
|
|
# Modules
|
| 185 |
|
|
#
|
| 186 |
|
|
local module
|
| 187 |
|
|
modules_dir="${D}/usr/lib/dracut/modules.d"
|
| 188 |
|
|
|
| 189 |
|
|
# Remove modules not enabled by USE flags
|
| 190 |
|
|
for module in ${IUSE_DRACUT_MODULES} ; do
|
| 191 |
|
|
! use ${module} && rm_module -f ${module#dracut_modules_}
|
| 192 |
|
|
done
|
| 193 |
|
|
|
| 194 |
|
|
# Those flags are specific, and even are corresponding to modules, they need
|
| 195 |
|
|
# to be declared as regular USE flags.
|
| 196 |
|
|
use debug || rm_module 95debug
|
| 197 |
|
|
use selinux || rm_module 98selinux
|
| 198 |
|
|
|
| 199 |
|
|
# Following flags define set of helper modules which are base dependencies
|
| 200 |
|
|
# for others and as so have no practical use, so remove these modules.
|
| 201 |
|
|
use device-mapper || rm_module 90dm
|
| 202 |
|
|
use net || rm_module 40network 45ifcfg 45url-lib
|
| 203 |
|
|
|
| 204 |
|
|
# Remove S/390 modules which are not tested at all
|
| 205 |
|
|
rm_module 80cms 95dasd 95dasd_mod 95zfcp 95znet
|
| 206 |
|
|
|
| 207 |
|
|
# Remove modules which won't work for sure
|
| 208 |
|
|
rm_module 95fcoe # no tools
|
| 209 |
|
|
# fips module depends on masked app-crypt/hmaccalc
|
| 210 |
|
|
rm_module 01fips 02fips-aesni
|
| 211 |
|
|
|
| 212 |
|
|
# Remove extra modules which go to future dracut-extras
|
| 213 |
|
|
rm_module 05busybox 97masterkey 98ecryptfs 98integrity 98systemd
|
| 214 |
|
|
}
|
| 215 |
|
|
|
| 216 |
|
|
pkg_postinst() {
|
| 217 |
|
|
if linux-info_get_any_version && linux_config_src_exists; then
|
| 218 |
|
|
ewarn ""
|
| 219 |
|
|
ewarn "If the following test report contains a missing kernel"
|
| 220 |
|
|
ewarn "configuration option, you should reconfigure and rebuild your"
|
| 221 |
|
|
ewarn "kernel before booting image generated with this Dracut version."
|
| 222 |
|
|
ewarn ""
|
| 223 |
|
|
|
| 224 |
|
|
local CONFIG_CHECK="~BLK_DEV_INITRD ~DEVTMPFS ~MODULES"
|
| 225 |
|
|
|
| 226 |
|
|
# Kernel configuration options descriptions:
|
| 227 |
|
|
local desc_DEVTMPFS="Maintain a devtmpfs filesystem to mount at /dev"
|
| 228 |
|
|
local desc_BLK_DEV_INITRD="Initial RAM filesystem and RAM disk "\
|
| 229 |
|
|
"(initramfs/initrd) support"
|
| 230 |
|
|
local desc_MODULES="Enable loadable module support"
|
| 231 |
|
|
|
| 232 |
|
|
local opt desc
|
| 233 |
|
|
|
| 234 |
|
|
# Generate ERROR_* variables for check_extra_config.
|
| 235 |
|
|
for opt in ${CONFIG_CHECK}; do
|
| 236 |
|
|
opt=${opt#\~}
|
| 237 |
|
|
desc=desc_${opt}
|
| 238 |
|
|
eval "local ERROR_${opt}='CONFIG_${opt}: \"${!desc}\"" \
|
| 239 |
|
|
"is missing and REQUIRED'"
|
| 240 |
|
|
done
|
| 241 |
|
|
|
| 242 |
|
|
check_extra_config
|
| 243 |
|
|
echo
|
| 244 |
|
|
else
|
| 245 |
|
|
ewarn ""
|
| 246 |
|
|
ewarn "Your kernel configuration couldn't be checked. Do you have"
|
| 247 |
|
|
ewarn "/usr/src/linux/.config file there? Please check manually if"
|
| 248 |
|
|
ewarn "following options are enabled:"
|
| 249 |
|
|
ewarn ""
|
| 250 |
|
|
ewarn " CONFIG_BLK_DEV_INITRD"
|
| 251 |
|
|
ewarn " CONFIG_DEVTMPFS"
|
| 252 |
|
|
ewarn " CONFIG_MODULES"
|
| 253 |
|
|
ewarn ""
|
| 254 |
|
|
fi
|
| 255 |
|
|
|
| 256 |
|
|
if has_version virtual/pkgconfig; then
|
| 257 |
|
|
elog ""
|
| 258 |
|
|
elog "virtual/pkgconfig is no longer needed by dracut."
|
| 259 |
|
|
elog ""
|
| 260 |
|
|
fi
|
| 261 |
|
|
}
|