sys-kernel/dracut-{011,013}: Fixed bug #380111.
authorAmadeusz Żołnowski <aidecoe@gentoo.org>
Sun, 4 Sep 2011 14:51:09 +0000 (14:51 +0000)
committerAmadeusz Żołnowski <aidecoe@gentoo.org>
Sun, 4 Sep 2011 14:51:09 +0000 (14:51 +0000)
Package-Manager: portage-2.1.10.13/cvs/Linux x86_64

sys-kernel/dracut/ChangeLog
sys-kernel/dracut/Manifest
sys-kernel/dracut/dracut-011-r1.ebuild [new file with mode: 0644]
sys-kernel/dracut/dracut-013-r1.ebuild [new file with mode: 0644]
sys-kernel/dracut/files/dracut-011-integrated-initramfs-fix.patch [new file with mode: 0644]
sys-kernel/dracut/files/dracut-013-integrated-initramfs-fix.patch [new file with mode: 0644]

index f5dc36f89c477f04d417830fe20a046c4cb7d341..d44abdfc76945ca0f8cb9400cec7bf5b3a0ecb42 100644 (file)
@@ -1,6 +1,15 @@
 # ChangeLog for sys-kernel/dracut
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/ChangeLog,v 1.30 2011/08/31 13:05:42 aidecoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/ChangeLog,v 1.31 2011/09/04 14:51:09 aidecoe Exp $
+
+*dracut-013-r1 (04 Sep 2011)
+*dracut-011-r1 (04 Sep 2011)
+
+  04 Sep 2011; Amadeusz Żołnowski <aidecoe@gentoo.org> +dracut-011-r1.ebuild,
+  +files/dracut-011-integrated-initramfs-fix.patch, +dracut-013-r1.ebuild,
+  +files/dracut-013-integrated-initramfs-fix.patch:
+  Fixed bug #380111 - "kernels with integrated initramfs and dracut failed to
+  boot"
 
   31 Aug 2011; Amadeusz Żołnowski <aidecoe@gentoo.org> -dracut-007.ebuild,
   -files/dracut-007-dm-udev-rules.patch,
index 5801f053d9db6eddaf66c941f9f7f6d9b0f424f6..cf752519e38085b5ea49e99767d544ee1075ecc8 100644 (file)
@@ -5,7 +5,9 @@ AUX dracut-010-empty-etc-ld.so.conf.d.patch 775 RMD160 0e8463dd1fabdfabab26861c4
 AUX dracut-010-multipath-udev-rules.patch 848 RMD160 99527326b1c5c33647a750d4bba2da9b6b5f0c92 SHA1 353c065322645f063fd3ae90ece7635eab8225ed SHA256 0e2215897b7cbac1bf9c84b42d6eb8af4438674934749bc339f768cba6662c18
 AUX dracut-010-rd.driver.post-fixed.patch 1080 RMD160 2ab3ff1c7fef4d8d8e1fa1f5176b42e2b390fe16 SHA1 4c7ddc8dca44138c0fede8c218487aa8787547e7 SHA256 a03f0beaf47b4afde8f4945f97ae240edc1a61d71653c8c6e5120bfcbacb530b
 AUX dracut-010-rd.driver.pre-and-blacklist-fix.patch 1152 RMD160 49981662b15e9a5bdcba577acae19c4a1ad7eb11 SHA1 88b06237813c8e0a4f6266dc2d62870e67b94671 SHA256 cc4e049e02a89a5fb4d78e42dea970f11e726608aab20b4e69d35e712c106119
+AUX dracut-011-integrated-initramfs-fix.patch 800 RMD160 a870763a3c4c5a9acdafea582da55c7cd8b9446a SHA1 8d3a938c1626bcae049f89dab83386b529a6e8ea SHA256 4eed4888a9489c76eaab774980e45d2ca63f40834b6b81891352696e6e0fac4a
 AUX dracut-011-multipath-udev-rules.patch 848 RMD160 99527326b1c5c33647a750d4bba2da9b6b5f0c92 SHA1 353c065322645f063fd3ae90ece7635eab8225ed SHA256 0e2215897b7cbac1bf9c84b42d6eb8af4438674934749bc339f768cba6662c18
+AUX dracut-013-integrated-initramfs-fix.patch 800 RMD160 a870763a3c4c5a9acdafea582da55c7cd8b9446a SHA1 8d3a938c1626bcae049f89dab83386b529a6e8ea SHA256 4eed4888a9489c76eaab774980e45d2ca63f40834b6b81891352696e6e0fac4a
 AUX dracut-013-livenet-gentoo-ca-bundle-path.patch 2434 RMD160 6b25686da38045cd5263672cf638a3fc27cf6a02 SHA1 31828b1eb4499c967814acfbfc38b3c9a11bfeba SHA256 e4fad958c9eb458e6ca131b63033d1631252726e6192d4da285056b8dfd27cfa
 AUX dracut-013-multipath-udev-rules.patch 848 RMD160 99527326b1c5c33647a750d4bba2da9b6b5f0c92 SHA1 353c065322645f063fd3ae90ece7635eab8225ed SHA256 0e2215897b7cbac1bf9c84b42d6eb8af4438674934749bc339f768cba6662c18
 DIST dracut-008.tar.bz2 136218 RMD160 2804a92c99539c19af54f256da2ceca34cff110a SHA1 7a3d3133ee52d824f11c9b2ccfca56fb983bda81 SHA256 f0cb0e022064c5b2fe02af9906f19ad77000d5f1813fe6cd57b037aaee921d31
@@ -14,18 +16,20 @@ DIST dracut-011.tar.bz2 146262 RMD160 5ec3584f92590ee27e2ee6ecfbd25edead1c82a2 S
 DIST dracut-013.tar.bz2 149337 RMD160 0d0eb8a84ea0cd208afe433f28e49bfb0b423209 SHA1 1e1c7fd6f7919399fb20f25f662d0529b61f4078 SHA256 5e63cd711f28e13088a095186095e1af2561be422d1e5d0e4ab351205010c717
 EBUILD dracut-008-r1.ebuild 5832 RMD160 5a5f978f28be2cdef5f6df5782d623b25a417123 SHA1 6ec710509d56427941e00cf0bff6edf16d892f2a SHA256 95c03df493e91c716de5573a9a33134dd6a660a31ddbf8f9dbd7317b1d979ddc
 EBUILD dracut-010-r3.ebuild 6050 RMD160 d6bf1562f9956eee52d7d54ac6824a56401b80d5 SHA1 704d2e9f53e82e06f1b904d542b926abb565f6b1 SHA256 377c77f8795b0641c1fc076d50af21544d799f56fa65e64a5aaf4a99754213d9
+EBUILD dracut-011-r1.ebuild 6006 RMD160 6c9035b0356ebd1f0781bc152fe2f8a279672727 SHA1 f59f112f4e04bf1355540abbee97b134c08c4add SHA256 baeb6e735b227fb3023b735d7bb1cf04184dfc6fe7d93a26b3f5f76a517dede0
 EBUILD dracut-011.ebuild 5945 RMD160 83d91c5c69415510993af9e86f173def99c90560 SHA1 60f1149dd09ec9a1856ec1d7be2d7fd6524e9344 SHA256 5ffb020b023979218a03b06ff262829eb5ba5dd7b43b1db6f509a26c52a7e7d2
+EBUILD dracut-013-r1.ebuild 6304 RMD160 b5f09ff01ec0002d3142d96dc3d0e6b500f24d9f SHA1 9cf8b8ff5639ff18faf3158e15d15c4a7cd47a4d SHA256 02f44474196340319158acc6da88546052c09aa64cdb23c987804f6aa6c1c80e
 EBUILD dracut-013.ebuild 6243 RMD160 04e2a89398a2d3a01afe624381e4853ea4104949 SHA1 3a9295fb36a63a44e457895f0cd445f20a173899 SHA256 213069727c2ac954e048560a14c7c995ca47dbc069e5e493688eef0fe230ce1f
-MISC ChangeLog 9576 RMD160 552c293c743734e4a05a6ae36856d683bdf1b0d1 SHA1 59e3353cc20f54626f66ca788494a5ef4a59dd76 SHA256 635fbef5092c5ef20276dede20ecf9b92f0a186aef786565ad0459002def303e
+MISC ChangeLog 9929 RMD160 cef325114900bb98643730ee5d51b10a78401b9b SHA1 59172cd51965bd19bb9a180f334e7662ab966212 SHA256 f1cd6c45796fb45a3a65a0e02653d160fc4391db0f099264103ea7efa420afb2
 MISC metadata.xml 624 RMD160 42a729436ab46593794e94c3a62baab459cb14cc SHA1 85bff3093a413f3084a3aa2fc0d61229fa014753 SHA256 694067a4baec7ea33ae867985b7d7e355d4a02fdfccaa242ce954fcebd93c8d0
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
-iQEcBAEBAgAGBQJOXjGrAAoJEPATRTHh2/q13AYH/3kzUIUHHZ3CFX55NfFI/hPe
-txUmJzFsexq/2NkubfM8Pgob/JyBi7lOklcYScAeO6uU229oFCKMwyHQYL9xve0u
-xZ3WqZKNH1R3a4gUGr+gkpDGifEhGBnp+5kaiEwELyIyG2UsbtFHBXq55HoX4Rjt
-U2J4yT7FN3IbnymlQRl89Wr/KEfNOCjE3A4D3Tiow+Kvi+RwDQtJgw8shKkcyCh/
-l1mSwQ8MWGCQKOpDbeyhu1Feps0F9P9sBbm4RBpDdxobEwQ66tUmK9h/ZoOke9fB
-m0iz3Sz/7xmZ8+WpZlLjQi+zl3XqkIuF/GA5TODAuHpLAI7DdogqsIjUKWJiwR4=
-=s0Hi
+iQEcBAEBAgAGBQJOY5BiAAoJEPATRTHh2/q1TvUIAIw4X9sPi40ymhAL8ZY0WC7p
+gjq9dO59Zt29kopXxyt8br7mM/Bk0HWSDr5FL2SA+q7rjwcwngtRJJ+TgMIeo4I8
+iIfqGQyiQD/i7nmxuXRdsEXMw157eEYbzF6d8zgQYOVI6UUNgk7xx9pAv3GF75Jr
+VMyhx2my2s0G92+d9q4wC5GXlg96+Gh4A0aNL19iaARVFoDOxa+XGG0fIU1CVhHX
+wjjcoFlciI6MkpVpmnSEaVjqwq9ik6IZLfTvLk++xcJ6+s3ej33Pz9WVyhiHyAss
+2pSqONJfhMmhmDDJWaXNV5hzb8I/cmHwXmsih5S5tmcRL/yoPrlJtZjPzW5rY5w=
+=BnCn
 -----END PGP SIGNATURE-----
diff --git a/sys-kernel/dracut/dracut-011-r1.ebuild b/sys-kernel/dracut/dracut-011-r1.ebuild
new file mode 100644 (file)
index 0000000..c189b61
--- /dev/null
@@ -0,0 +1,216 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/dracut-011-r1.ebuild,v 1.1 2011/09/04 14:51:09 aidecoe Exp $
+
+EAPI=2
+
+inherit eutils
+
+DESCRIPTION="Generic initramfs generation tool"
+HOMEPAGE="http://dracut.wiki.kernel.org"
+SRC_URI="mirror://kernel/linux/utils/boot/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+
+COMMON_MODULES="
+       dracut_modules_biosdevname
+       dracut_modules_btrfs
+       dracut_modules_caps
+       dracut_modules_crypt-gpg
+       dracut_modules_gensplash
+       dracut_modules_mdraid
+       dracut_modules_multipath
+       dracut_modules_plymouth
+       dracut_modules_syslog
+       dracut_modules_xen
+       "
+NETWORK_MODULES="
+       dracut_modules_iscsi
+       dracut_modules_nbd
+       dracut_modules_nfs
+       "
+DM_MODULES="
+       dracut_modules_crypt
+       dracut_modules_dmraid
+       dracut_modules_dmsquash-live
+       dracut_modules_lvm
+       "
+IUSE_DRACUT_MODULES="${COMMON_MODULES} ${DM_MODULES} ${NETWORK_MODULES}"
+IUSE="debug selinux ${IUSE_DRACUT_MODULES}"
+RESTRICT="test"
+
+NETWORK_DEPS="net-misc/bridge-utils >=net-misc/dhcp-4.2.1-r1 sys-apps/iproute2
+       net-misc/ifenslave"
+DM_DEPS="|| ( sys-fs/device-mapper >=sys-fs/lvm2-2.02.33 )"
+
+RDEPEND="
+       >=app-shells/bash-4.0
+       >=app-shells/dash-0.5.4.11
+       >=sys-apps/baselayout-1.12.14-r1
+       >=sys-apps/module-init-tools-3.8
+       >=sys-apps/sysvinit-2.87-r3
+       >=sys-apps/util-linux-2.16
+       >=sys-fs/udev-168
+
+       debug? ( dev-util/strace )
+       selinux? ( sys-libs/libselinux sys-libs/libsepol )
+       dracut_modules_biosdevname? ( sys-apps/biosdevname )
+       dracut_modules_btrfs? ( sys-fs/btrfs-progs )
+       dracut_modules_caps? ( sys-libs/libcap )
+       dracut_modules_crypt? ( sys-fs/cryptsetup ${DM_DEPS} )
+       dracut_modules_crypt-gpg? ( app-crypt/gnupg )
+       dracut_modules_dmraid? ( sys-fs/dmraid sys-fs/multipath-tools ${DM_DEPS} )
+       dracut_modules_dmsquash-live? ( virtual/eject ${DM_DEPS} )
+       dracut_modules_gensplash? ( media-gfx/splashutils )
+       dracut_modules_iscsi? ( >=sys-block/open-iscsi-2.0.871.3 ${NETWORK_DEPS} )
+       dracut_modules_lvm? ( >=sys-fs/lvm2-2.02.33 )
+       dracut_modules_mdraid? ( sys-fs/mdadm )
+       dracut_modules_multipath? ( sys-fs/multipath-tools )
+       dracut_modules_nbd? ( sys-block/nbd ${NETWORK_DEPS} )
+       dracut_modules_nfs? ( net-fs/nfs-utils net-nds/rpcbind ${NETWORK_DEPS} )
+       dracut_modules_plymouth? ( >=sys-boot/plymouth-0.8.3-r1 )
+       dracut_modules_syslog? ( || ( app-admin/syslog-ng app-admin/rsyslog ) )
+       dracut_modules_xen? ( app-emulation/xen )
+       "
+DEPEND="
+       >=dev-libs/libxslt-1.1.26
+       app-text/docbook-xml-dtd:4.5
+       >=app-text/docbook-xsl-stylesheets-1.75.2
+       "
+
+#
+# Helper functions
+#
+
+# Returns true if any of specified modules is enabled by USE flag and false
+# otherwise.
+# $1 = list of modules (which have corresponding USE flags of the same name)
+any_module() {
+       local m modules=" $@ "
+
+       for m in ${modules}; do
+               ! use $m && modules=${modules/ $m / }
+       done
+
+       shopt -s extglob
+       modules=${modules%%+( )}
+       shopt -u extglob
+
+       [[ ${modules} ]]
+}
+
+# Removes module from modules.d.
+# $1 = module name
+# Module name can be specified without number prefix.
+rm_module() {
+       local m
+
+       for m in $@; do
+               if [[ $m =~ ^[0-9][0-9][^\ ]*$ ]]; then
+                       rm -rf "${modules_dir}"/$m
+               else
+                       rm -rf "${modules_dir}"/[0-9][0-9]$m
+               fi
+       done
+}
+
+# Displays Gentoo Base System major release number
+base_sys_maj_ver() {
+       local line
+
+       read line < /etc/gentoo-release
+       line=${line##* }
+       echo "${line%%.*}"
+}
+
+#
+# ebuild functions
+#
+
+src_prepare() {
+       epatch "${FILESDIR}/${P}-multipath-udev-rules.patch"
+       epatch "${FILESDIR}/${P}-integrated-initramfs-fix.patch"
+}
+
+src_compile() {
+       emake WITH_SWITCH_ROOT=0 || die "emake failed"
+}
+
+src_install() {
+       emake WITH_SWITCH_ROOT=0 \
+               prefix=/usr sysconfdir=/etc DESTDIR="${D}" \
+               install || die "emake install failed"
+
+       local gen2conf
+
+       dodir /var/lib/dracut/overlay
+       dodoc HACKING TODO AUTHORS NEWS README* || die 'dodoc failed'
+
+       case "$(base_sys_maj_ver)" in
+               1) gen2conf=gentoo.conf ;;
+               2) gen2conf=gentoo-openrc.conf ;;
+               *) die "Expected ver. 1 or 2 of Gentoo Base System (/etc/gentoo-release)."
+       esac
+
+       insinto /etc/dracut.conf.d
+       newins dracut.conf.d/${gen2conf}.example ${gen2conf} \
+               || die 'gen2conf ins failed'
+
+       insinto /etc/logrotate.d
+       newins dracut.logrotate dracut || die 'dracut.logrotate ins failed'
+
+       #
+       # Modules
+       #
+       local module
+       modules_dir="${D}/usr/share/dracut/modules.d"
+
+       echo "${PF}" > "${modules_dir}"/10rpmversion/dracut-version \
+               || die 'dracut-version failed'
+
+       # Remove modules not enabled by USE flags
+       for module in ${IUSE_DRACUT_MODULES} ; do
+               ! use ${module} && rm_module ${module#dracut_modules_}
+       done
+
+       # Those flags are specific, and even are corresponding to modules, they need
+       # to be declared as regular USE flags.
+       use debug || rm_module 95debug
+       use selinux || rm_module 98selinux
+
+       ! any_module ${DM_MODULES} && rm_module 90dm
+       ! any_module ${NETWORK_MODULES} && rm_module 45ifcfg 40network
+
+       # Remove S/390 modules which are not tested at all
+       rm_module 95dasd 95dasd_mod 95zfcp 95znet
+
+       # Remove modules which won't work for sure
+       rm_module 00bootchart 05busybox # broken
+       rm_module 95fcoe # no tools
+
+       # fips module depends on masked app-crypt/hmaccalc
+       rm_module 01fips
+}
+
+pkg_postinst() {
+       elog 'To generate the initramfs:'
+       elog '    # mount /boot (if necessary)'
+       elog '    # dracut "" <kernel-version>'
+       elog ''
+       elog 'For command line documentation see dracut.kernel(7).'
+       elog ''
+       elog 'Simple example to select root and resume partition:'
+       elog '    root=/dev/sda1 resume=/dev/sda2'
+       elog ''
+       elog 'The default config (in /etc/dracut.conf) is very minimal and is highly'
+       elog 'recommended you adjust based on your needs. To include only dracut'
+       elog 'modules and kernel drivers for this system, use the "-H" option.'
+       elog 'Some modules need to be explicitly added with "-a" option even if'
+       elog 'required tools are installed.'
+       echo
+       elog 'Options (documented in dracut.kernel(7)) have new format since'
+       elog 'version 008. Old format is preserved, but will be removed in future.'
+       elog 'Please migrate to the new one.'
+}
diff --git a/sys-kernel/dracut/dracut-013-r1.ebuild b/sys-kernel/dracut/dracut-013-r1.ebuild
new file mode 100644 (file)
index 0000000..6413c88
--- /dev/null
@@ -0,0 +1,226 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/dracut-013-r1.ebuild,v 1.1 2011/09/04 14:51:09 aidecoe Exp $
+
+EAPI=4
+
+inherit eutils
+
+DESCRIPTION="Generic initramfs generation tool"
+HOMEPAGE="http://dracut.wiki.kernel.org"
+SRC_URI="mirror://kernel/linux/utils/boot/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+REQUIRED_USE="dracut_modules_livenet? ( dracut_modules_dmsquash-live )
+       dracut_modules_crypt-gpg? ( dracut_modules_crypt )
+       "
+
+BASIC_MODULES="
+       "
+COMMON_MODULES="
+       dracut_modules_biosdevname
+       dracut_modules_btrfs
+       dracut_modules_caps
+       dracut_modules_crypt-gpg
+       dracut_modules_gensplash
+       dracut_modules_mdraid
+       dracut_modules_multipath
+       dracut_modules_plymouth
+       dracut_modules_syslog
+       dracut_modules_xen
+       "
+NETWORK_MODULES="
+       dracut_modules_iscsi
+       dracut_modules_livenet
+       dracut_modules_nbd
+       dracut_modules_nfs
+       "
+DM_MODULES="
+       dracut_modules_crypt
+       dracut_modules_dmraid
+       dracut_modules_dmsquash-live
+       dracut_modules_livenet
+       dracut_modules_lvm
+       "
+IUSE_DRACUT_MODULES="${COMMON_MODULES} ${DM_MODULES} ${NETWORK_MODULES}"
+IUSE="debug selinux ${IUSE_DRACUT_MODULES}"
+RESTRICT="test"
+
+NETWORK_DEPS=">=net-misc/dhcp-4.2.1-r1 sys-apps/iproute2"
+DM_DEPS="|| ( sys-fs/device-mapper >=sys-fs/lvm2-2.02.33 )"
+
+RDEPEND="
+       >=app-shells/bash-4.0
+       >=app-shells/dash-0.5.4.11
+       >=sys-apps/baselayout-1.12.14-r1
+       >=sys-apps/module-init-tools-3.8
+       >=sys-apps/sysvinit-2.87-r3
+       >=sys-apps/util-linux-2.16
+       >=sys-fs/udev-164
+
+       debug? ( dev-util/strace )
+       selinux? ( sys-libs/libselinux sys-libs/libsepol )
+       dracut_modules_biosdevname? ( sys-apps/biosdevname )
+       dracut_modules_btrfs? ( sys-fs/btrfs-progs )
+       dracut_modules_caps? ( sys-libs/libcap )
+       dracut_modules_crypt? ( sys-fs/cryptsetup ${DM_DEPS} )
+       dracut_modules_crypt-gpg? ( app-crypt/gnupg )
+       dracut_modules_dmraid? ( sys-fs/dmraid sys-fs/multipath-tools ${DM_DEPS} )
+       dracut_modules_dmsquash-live? ( ${DM_DEPS} )
+       dracut_modules_gensplash? ( media-gfx/splashutils )
+       dracut_modules_iscsi? ( >=sys-block/open-iscsi-2.0.871.3 ${NETWORK_DEPS} )
+       dracut_modules_lvm? ( >=sys-fs/lvm2-2.02.33 )
+       dracut_modules_mdraid? ( sys-fs/mdadm )
+       dracut_modules_multipath? ( sys-fs/multipath-tools )
+       dracut_modules_nbd? ( sys-block/nbd ${NETWORK_DEPS} )
+       dracut_modules_nfs? ( net-fs/nfs-utils net-nds/rpcbind ${NETWORK_DEPS} )
+       dracut_modules_plymouth? ( >=sys-boot/plymouth-0.8.3-r1 )
+       dracut_modules_syslog? ( || ( app-admin/syslog-ng app-admin/rsyslog ) )
+       dracut_modules_xen? ( app-emulation/xen )
+       "
+DEPEND="
+       >=dev-libs/libxslt-1.1.26
+       app-text/docbook-xml-dtd:4.5
+       >=app-text/docbook-xsl-stylesheets-1.75.2
+       "
+
+#
+# Helper functions
+#
+
+# Returns true if any of specified modules is enabled by USE flag and false
+# otherwise.
+# $1 = list of modules (which have corresponding USE flags of the same name)
+any_module() {
+       local m modules=" $@ "
+
+       for m in ${modules}; do
+               ! use $m && modules=${modules/ $m / }
+       done
+
+       shopt -s extglob
+       modules=${modules%%+( )}
+       shopt -u extglob
+
+       [[ ${modules} ]]
+}
+
+# Removes module from modules.d.
+# $1 = module name
+# Module name can be specified without number prefix.
+rm_module() {
+       local m
+
+       for m in $@; do
+               if [[ $m =~ ^[0-9][0-9][^\ ]*$ ]]; then
+                       rm -rf "${modules_dir}"/$m
+               else
+                       rm -rf "${modules_dir}"/[0-9][0-9]$m
+               fi
+       done
+}
+
+# Displays Gentoo Base System major release number
+base_sys_maj_ver() {
+       local line
+
+       read line < /etc/gentoo-release
+       line=${line##* }
+       echo "${line%%.*}"
+}
+
+#
+# ebuild functions
+#
+
+src_prepare() {
+       epatch "${FILESDIR}/${P}-multipath-udev-rules.patch"
+       epatch "${FILESDIR}/${P}-livenet-gentoo-ca-bundle-path.patch"
+       epatch "${FILESDIR}/${P}-integrated-initramfs-fix.patch"
+}
+
+src_compile() {
+       emake WITH_SWITCH_ROOT=0
+}
+
+src_install() {
+       emake WITH_SWITCH_ROOT=0 \
+               prefix=/usr sysconfdir=/etc DESTDIR="${D}" \
+               install
+
+       local gen2conf
+
+       dodir /var/lib/dracut/overlay
+       dodoc HACKING TODO AUTHORS NEWS README*
+
+       case "$(base_sys_maj_ver)" in
+               1) gen2conf=gentoo.conf ;;
+               2) gen2conf=gentoo-openrc.conf ;;
+               *) die "Expected ver. 1 or 2 of Gentoo Base System (/etc/gentoo-release)."
+       esac
+
+       insinto /etc/dracut.conf.d
+       newins dracut.conf.d/${gen2conf}.example ${gen2conf}
+
+       insinto /etc/logrotate.d
+       newins dracut.logrotate dracut
+
+       #
+       # Modules
+       #
+       local module
+       modules_dir="${D}/usr/share/dracut/modules.d"
+
+       echo "${PF}" > "${modules_dir}"/10rpmversion/dracut-version \
+               || die 'dracut-version failed'
+
+       # Remove modules not enabled by USE flags
+       for module in ${IUSE_DRACUT_MODULES} ; do
+               ! use ${module} && rm_module ${module#dracut_modules_}
+       done
+
+       # Those flags are specific, and even are corresponding to modules, they need
+       # to be declared as regular USE flags.
+       use debug || rm_module 95debug
+       use selinux || rm_module 98selinux
+
+       ! any_module ${DM_MODULES} && rm_module 90dm
+       ! any_module ${NETWORK_MODULES} && rm_module 45ifcfg 40network
+
+       # Remove S/390 modules which are not tested at all
+       rm_module 95dasd 95dasd_mod 95zfcp 95znet
+
+       # Remove modules which won't work for sure
+       rm_module 95fcoe # no tools
+       # fips module depends on masked app-crypt/hmaccalc
+       rm_module 01fips
+
+       # Remove extra modules which go to future dracut-extras
+       rm_module 00bootchart 05busybox 97masterkey 98ecryptfs 98integrity
+}
+
+pkg_postinst() {
+       elog 'To generate the initramfs:'
+       elog '    # mount /boot (if necessary)'
+       elog '    # dracut "" <kernel-version>'
+       elog ''
+       elog 'For command line documentation see dracut.kernel(7).'
+       elog ''
+       elog 'Simple example to select root and resume partition:'
+       elog '    root=/dev/sda1 resume=/dev/sda2'
+       elog ''
+       elog 'The default config (in /etc/dracut.conf) is very minimal and is highly'
+       elog 'recommended you adjust based on your needs. To include only dracut'
+       elog 'modules and kernel drivers for this system, use the "-H" option.'
+       elog 'Some modules need to be explicitly added with "-a" option even if'
+       elog 'required tools are installed.'
+       echo
+       elog 'Options (documented in dracut.kernel(7)) have new format since'
+       elog 'version 008. Old format is preserved, but will be removed in future.'
+       elog 'Please migrate to the new one.'
+       echo
+       elog 'Some dependencies were removed, because they are optional. dracut'
+       elog "will inform you with a warning when you're lacking something optional."
+}
diff --git a/sys-kernel/dracut/files/dracut-011-integrated-initramfs-fix.patch b/sys-kernel/dracut/files/dracut-011-integrated-initramfs-fix.patch
new file mode 100644 (file)
index 0000000..df41f00
--- /dev/null
@@ -0,0 +1,27 @@
+From 1a553e2bc9f3157cdd6957ab55dfc4b62d82dec6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
+Date: Sun, 4 Sep 2011 16:30:39 +0200
+Subject: [PATCH] dracut: create /dev besides /proc, /sys and so
+
+How it worked without it?  The issue only manifests itself with
+initramfs integrated into kernel.
+---
+ dracut |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/dracut b/dracut
+index fd36805..b317d70 100755
+--- a/dracut
++++ b/dracut
+@@ -510,7 +510,7 @@ if [[ $kernel_only != yes ]]; then
+         fi
+     done
+-    for d in proc sys sysroot root run run/lock run/initramfs; do
++    for d in dev proc sys sysroot root run run/lock run/initramfs; do
+         if [ -h "/$d" ]; then
+             inst "/$d"
+         else
+-- 
+1.7.6.1
+
diff --git a/sys-kernel/dracut/files/dracut-013-integrated-initramfs-fix.patch b/sys-kernel/dracut/files/dracut-013-integrated-initramfs-fix.patch
new file mode 100644 (file)
index 0000000..df41f00
--- /dev/null
@@ -0,0 +1,27 @@
+From 1a553e2bc9f3157cdd6957ab55dfc4b62d82dec6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
+Date: Sun, 4 Sep 2011 16:30:39 +0200
+Subject: [PATCH] dracut: create /dev besides /proc, /sys and so
+
+How it worked without it?  The issue only manifests itself with
+initramfs integrated into kernel.
+---
+ dracut |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/dracut b/dracut
+index fd36805..b317d70 100755
+--- a/dracut
++++ b/dracut
+@@ -510,7 +510,7 @@ if [[ $kernel_only != yes ]]; then
+         fi
+     done
+-    for d in proc sys sysroot root run run/lock run/initramfs; do
++    for d in dev proc sys sysroot root run run/lock run/initramfs; do
+         if [ -h "/$d" ]; then
+             inst "/$d"
+         else
+-- 
+1.7.6.1
+