diff options
author | Amadeusz Piotr Żołnowski <aidecoe@gentoo.org> | 2013-03-12 08:47:58 +0000 |
---|---|---|
committer | Amadeusz Piotr Żołnowski <aidecoe@gentoo.org> | 2013-03-12 08:47:58 +0000 |
commit | b8d7a732caf0b483591075f5675d0ab2f3abb4d2 (patch) | |
tree | 94a5acdff946b20ead0aa71b9927518c960ebb35 /sys-kernel | |
parent | bump (diff) | |
download | gentoo-2-b8d7a732caf0b483591075f5675d0ab2f3abb4d2.tar.gz gentoo-2-b8d7a732caf0b483591075f5675d0ab2f3abb4d2.tar.bz2 gentoo-2-b8d7a732caf0b483591075f5675d0ab2f3abb4d2.zip |
Fixed crypt, dmraid and mdraid detection as explained in previous entry:
> Gentoo release doesn't include a fix to catch all UUIDs (for crypt, dmraid,
> mdraid) and not only the first one, because the fix actually breaks
> something and LUKS devices aren't detected correctly at build time. If this
> fix is fixed it will come in dracut-026-r1 ASAP.
Moreover lsinitrd script has been fixed.
(Portage version: 2.1.11.55/cvs/Linux x86_64, signed Manifest commit with key F0134531E1DBFAB5)
Diffstat (limited to 'sys-kernel')
5 files changed, 783 insertions, 1 deletions
diff --git a/sys-kernel/dracut/ChangeLog b/sys-kernel/dracut/ChangeLog index 5cb2df1face9..caabd4198371 100644 --- a/sys-kernel/dracut/ChangeLog +++ b/sys-kernel/dracut/ChangeLog @@ -1,6 +1,21 @@ # ChangeLog for sys-kernel/dracut # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/ChangeLog,v 1.112 2013/03/10 14:09:35 aidecoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/ChangeLog,v 1.113 2013/03/12 08:47:57 aidecoe Exp $ + +*dracut-026-r1 (12 Mar 2013) + + 12 Mar 2013; Amadeusz Żołnowski <aidecoe@gentoo.org> + +files/026-0004-lsinitrd.sh-fix-for-default-initrd-not.patch, + +files/026-0005-lsinitrd.sh-removed-trailing.patch, + +files/026-0006-make-host_fs_types-a-hashmap.patch, +dracut-026-r1.ebuild: + Fixed crypt, dmraid and mdraid detection as explained in previous entry: + + > Gentoo release doesn't include a fix to catch all UUIDs (for crypt, dmraid, + > mdraid) and not only the first one, because the fix actually breaks + > something and LUKS devices aren't detected correctly at build time. If this + > fix is fixed it will come in dracut-026-r1 ASAP. + + Moreover lsinitrd script has been fixed. *dracut-026 (10 Mar 2013) diff --git a/sys-kernel/dracut/dracut-026-r1.ebuild b/sys-kernel/dracut/dracut-026-r1.ebuild new file mode 100644 index 000000000000..021afdb18894 --- /dev/null +++ b/sys-kernel/dracut/dracut-026-r1.ebuild @@ -0,0 +1,291 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/dracut/dracut-026-r1.ebuild,v 1.1 2013/03/12 08:47:57 aidecoe Exp $ + +EAPI=4 + +inherit eutils linux-info + +add_req_use_for() { + local dep="$1"; shift + local f + + for f in "$@"; do + REQUIRED_USE+="${f}? ( ${dep} ) +" + done +} + +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="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86" + +REQUIRED_USE="dracut_modules_crypt-gpg? ( dracut_modules_crypt ) + dracut_modules_crypt-loop? ( dracut_modules_crypt ) + dracut_modules_livenet? ( dracut_modules_dmsquash-live ) + " +COMMON_MODULES=" + dracut_modules_biosdevname + dracut_modules_bootchart + dracut_modules_btrfs + dracut_modules_caps + dracut_modules_crypt-gpg + dracut_modules_crypt-loop + dracut_modules_gensplash + dracut_modules_mdraid + dracut_modules_multipath + dracut_modules_plymouth + dracut_modules_syslog + dracut_modules_systemd + " +DM_MODULES=" + dracut_modules_crypt + dracut_modules_dmraid + dracut_modules_dmsquash-live + dracut_modules_livenet + dracut_modules_lvm + " +NETWORK_MODULES=" + dracut_modules_cifs + dracut_modules_iscsi + dracut_modules_livenet + dracut_modules_nbd + dracut_modules_nfs + dracut_modules_ssh-client + " +add_req_use_for device-mapper ${DM_MODULES} +add_req_use_for net ${NETWORK_MODULES} +IUSE_DRACUT_MODULES="${COMMON_MODULES} ${DM_MODULES} ${NETWORK_MODULES}" +IUSE="debug device-mapper optimization net selinux ${IUSE_DRACUT_MODULES}" + +RESTRICT="test" + +CDEPEND=">sys-fs/udev-166 + dracut_modules_systemd? ( sys-apps/systemd ) + " +RDEPEND="${CDEPEND} + app-arch/cpio + >=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/kmod-5[tools] ) + >=sys-apps/sysvinit-2.87-r3 + >=sys-apps/util-linux-2.21 + virtual/pkgconfig + + debug? ( dev-util/strace ) + device-mapper? ( || ( sys-fs/device-mapper >=sys-fs/lvm2-2.02.33 ) ) + net? ( net-misc/curl >=net-misc/dhcp-4.2.4_p2-r1[client] sys-apps/iproute2 ) + selinux? ( sys-libs/libselinux sys-libs/libsepol ) + dracut_modules_biosdevname? ( sys-apps/biosdevname ) + dracut_modules_bootchart? ( app-benchmarks/bootchart2 sys-apps/usleep + sys-process/acct ) + dracut_modules_btrfs? ( sys-fs/btrfs-progs ) + dracut_modules_caps? ( sys-libs/libcap ) + dracut_modules_cifs? ( net-fs/cifs-utils ) + dracut_modules_crypt? ( sys-fs/cryptsetup ) + dracut_modules_crypt-gpg? ( app-crypt/gnupg ) + dracut_modules_dmraid? ( sys-fs/dmraid sys-fs/multipath-tools ) + dracut_modules_gensplash? ( media-gfx/splashutils ) + dracut_modules_iscsi? ( >=sys-block/open-iscsi-2.0.871.3 ) + 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 ) + dracut_modules_nfs? ( net-fs/nfs-utils net-nds/rpcbind ) + dracut_modules_plymouth? ( >=sys-boot/plymouth-0.8.3-r1 ) + dracut_modules_ssh-client? ( dev-libs/openssl ) + dracut_modules_syslog? ( || ( app-admin/syslog-ng app-admin/rsyslog ) ) + " +DEPEND="${CDEPEND} + app-text/asciidoc + >=dev-libs/libxslt-1.1.26 + app-text/docbook-xml-dtd:4.5 + >=app-text/docbook-xsl-stylesheets-1.75.2 + " + +DOCS=( AUTHORS HACKING NEWS README README.generic README.kernel README.modules + README.testsuite TODO ) +DRACUT_LIBDIR="/usr/lib" + +# +# 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 force m + [[ $1 = -f ]] && force=-f + + for m in $@; do + if [[ $m =~ ^[0-9][0-9][^\ ]*$ ]]; then + rm ${force} --interactive=never -r "${modules_dir}"/$m + else + rm ${force} --interactive=never -r "${modules_dir}"/[0-9][0-9]$m + fi + done +} + +# +# ebuild functions +# + +src_prepare() { + epatch "${FILESDIR}/${PV}-0001-dracut-functions.sh-support-for-altern.patch" + epatch "${FILESDIR}/${PV}-0002-gentoo.conf-let-udevdir-be-handled-by-.patch" + epatch "${FILESDIR}/${PV}-0004-lsinitrd.sh-fix-for-default-initrd-not.patch" + epatch "${FILESDIR}/${PV}-0005-lsinitrd.sh-removed-trailing.patch" + epatch "${FILESDIR}/${PV}-0006-make-host_fs_types-a-hashmap.patch" + chmod +x "${S}/modules.d/95udev-rules/udev-rules-prepare.sh" + + if use dracut_modules_systemd; then + local systemdutildir="$($(tc-getPKG_CONFIG) systemd \ + --variable=systemdutildir)" + local systemdsystemunitdir="$($(tc-getPKG_CONFIG) systemd \ + --variable=systemdsystemunitdir)" + [[ ${systemdutildir} ]] || die "Couldn't detect systemdutildir" + [[ ${systemdsystemunitdir} ]] \ + || die "Couldn't detect systemdsystemunitdir" + einfo "Setting systemdutildir to ${systemdutildir} and ..." + sed -e "4asystemdutildir=\"${systemdutildir}\"" \ + -i "${S}/dracut.conf.d/gentoo.conf.example" || die + einfo "Setting systemdsystemunitdir to ${systemdsystemunitdir}..." + sed -e "5asystemdsystemunitdir=\"${systemdsystemunitdir}\"" \ + -i "${S}/dracut.conf.d/gentoo.conf.example" || die + fi +} + +src_configure() { + econf --libdir="${DRACUT_LIBDIR}" +} + +src_compile() { + emake doc + + if use optimization; then + ewarn "Enabling experimental optimization!" + tc-export CC + emake install/dracut-install + fi +} + +src_install() { + default + + local libdir="${DRACUT_LIBDIR}" + + insinto "${libdir}/dracut/dracut.conf.d/" + newins dracut.conf.d/gentoo.conf.example gentoo.conf + + insinto /etc/logrotate.d + newins dracut.logrotate dracut + + dodir /var/lib/dracut/overlay + + dohtml dracut.html + + # + # Modules + # + local module + modules_dir="${D%/}/${libdir#/}/dracut/modules.d" + + # Remove modules not enabled by USE flags + for module in ${IUSE_DRACUT_MODULES} ; do + ! use ${module} && rm_module -f ${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 + + # Following flags define set of helper modules which are base dependencies + # for others and as so have no practical use, so remove these modules. + use device-mapper || rm_module 90dm + use net || rm_module 40network 45ifcfg 45url-lib + + # Remove S/390 modules which are not tested at all + rm_module 80cms 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 02fips-aesni + + # Remove extra modules which go to future dracut-extras + rm_module 05busybox 97masterkey 98ecryptfs 98integrity +} + +pkg_postinst() { + if linux-info_get_any_version && linux_config_src_exists; then + ewarn "" + ewarn "If the following test report contains a missing kernel" + ewarn "configuration option, you should reconfigure and rebuild your" + ewarn "kernel before booting image generated with this Dracut version." + ewarn "" + + local CONFIG_CHECK="~BLK_DEV_INITRD ~DEVTMPFS ~MODULES" + + # Kernel configuration options descriptions: + local desc_DEVTMPFS="Maintain a devtmpfs filesystem to mount at /dev" + local desc_BLK_DEV_INITRD="Initial RAM filesystem and RAM disk "\ +"(initramfs/initrd) support" + local desc_MODULES="Enable loadable module support" + + local opt desc + + # Generate ERROR_* variables for check_extra_config. + for opt in ${CONFIG_CHECK}; do + opt=${opt#\~} + desc=desc_${opt} + eval "local ERROR_${opt}='CONFIG_${opt}: \"${!desc}\"" \ + "is missing and REQUIRED'" + done + + check_extra_config + echo + else + ewarn "" + ewarn "Your kernel configuration couldn't be checked. Do you have" + ewarn "/usr/src/linux/.config file there? Please check manually if" + ewarn "following options are enabled:" + ewarn "" + ewarn " CONFIG_BLK_DEV_INITRD" + ewarn " CONFIG_DEVTMPFS" + ewarn " CONFIG_MODULES" + ewarn "" + fi + + if use dracut_modules_crypt || use dracut_modules_dmraid || use \ + dracut_modules_mdraid || use dracut_modules_lvm; then + + if ! [[ $(</proc/cmdline) =~ rd.auto[\ =] ]]; then + ewarn "Autoassembly of special devices like cryptoLUKS, dmraid, " + ewarn "mdraid or lvm is off for default as of >=dracut-024." + ewarn "Use rd.auto option to turn it on." + fi + fi +} diff --git a/sys-kernel/dracut/files/026-0004-lsinitrd.sh-fix-for-default-initrd-not.patch b/sys-kernel/dracut/files/026-0004-lsinitrd.sh-fix-for-default-initrd-not.patch new file mode 100644 index 000000000000..371644b25a2b --- /dev/null +++ b/sys-kernel/dracut/files/026-0004-lsinitrd.sh-fix-for-default-initrd-not.patch @@ -0,0 +1,42 @@ +From f6e0e5653fac1f856192bfafdcb2fbd86ed8a22a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer <harald@redhat.com> +Date: Sun, 10 Mar 2013 14:44:32 +0100 +Subject: [PATCH 3/5] lsinitrd.sh: fix for default initrd not found, but image + given + +--- + lsinitrd.sh | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 7a09423..4b8a7e2 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -54,16 +54,17 @@ if [[ "$1" ]]; then + usage + exit 1 + fi +-fi +- +-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id +- +-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then +- image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" + else +- image="/boot/initramfs-${KERNEL_VERSION}.img}" ++ [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++ ++ if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then ++ image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" ++ else ++ image="/boot/initramfs-${KERNEL_VERSION}.img}" ++ fi + fi + ++ + if ! [[ -f "$image" ]]; then + { + echo "No <initramfs file> specified and the default image '$image' cannot be accessed!" +-- +1.8.1.4 + diff --git a/sys-kernel/dracut/files/026-0005-lsinitrd.sh-removed-trailing.patch b/sys-kernel/dracut/files/026-0005-lsinitrd.sh-removed-trailing.patch new file mode 100644 index 000000000000..de2b87866699 --- /dev/null +++ b/sys-kernel/dracut/files/026-0005-lsinitrd.sh-removed-trailing.patch @@ -0,0 +1,25 @@ +From bf7a572d8f978e16d92385ebf36e2f837fc2f3d1 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer <harald@redhat.com> +Date: Mon, 11 Mar 2013 15:46:37 +0100 +Subject: [PATCH 4/5] lsinitrd.sh: removed trailing "}" + +--- + lsinitrd.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 4b8a7e2..5cd8c2a 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -60,7 +60,7 @@ else + if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then + image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" + else +- image="/boot/initramfs-${KERNEL_VERSION}.img}" ++ image="/boot/initramfs-${KERNEL_VERSION}.img" + fi + fi + +-- +1.8.1.4 + diff --git a/sys-kernel/dracut/files/026-0006-make-host_fs_types-a-hashmap.patch b/sys-kernel/dracut/files/026-0006-make-host_fs_types-a-hashmap.patch new file mode 100644 index 000000000000..13b28c5e16fb --- /dev/null +++ b/sys-kernel/dracut/files/026-0006-make-host_fs_types-a-hashmap.patch @@ -0,0 +1,409 @@ +From 86152848ed452bf1a01d0bea25c47ea54884a4fd Mon Sep 17 00:00:00 2001 +From: Harald Hoyer <harald@redhat.com> +Date: Mon, 11 Mar 2013 16:32:16 +0100 +Subject: [PATCH 5/5] make host_fs_types a hashmap + +This requires bash >= 4, but hash maps are so much more comfortable +--- + dracut-functions.sh | 14 +++--------- + dracut.sh | 23 +++++++++---------- + modules.d/90btrfs/module-setup.sh | 6 ++--- + modules.d/90crypt/module-setup.sh | 39 +++++++++++++++++++-------------- + modules.d/90dmraid/module-setup.sh | 34 ++++++++++++++++------------ + modules.d/90lvm/module-setup.sh | 36 +++++++++++++++++------------- + modules.d/90mdraid/module-setup.sh | 45 +++++++++++++++++++++----------------- + modules.d/95cifs/module-setup.sh | 2 +- + modules.d/95nfs/module-setup.sh | 6 ++--- + modules.d/95virtfs/module-setup.sh | 4 ++-- + 10 files changed, 112 insertions(+), 97 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index a6a609c..52a1781 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -450,23 +450,15 @@ find_mp_fstype() { + find_root_block_device() { find_block_device /; } + + # for_each_host_dev_fs <func> +-# Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found ++# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found + # in ${host_fs_types[@]} + for_each_host_dev_fs() + { + local _func="$1" + local _dev +- local _fs + local _ret=1 +- for f in ${host_fs_types[@]}; do +- OLDIFS="$IFS" +- IFS="|" +- set -- $f +- IFS="$OLDIFS" +- _dev="$1" +- [[ -b "$_dev" ]] || continue +- _fs="$2" +- $_func $_dev $_fs && _ret=0 ++ for _dev in "${!host_fs_types[@]}"; do ++ $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0 + done + return $_ret + } +diff --git a/dracut.sh b/dracut.sh +index 28ed4f1..15e66f3 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -744,11 +744,13 @@ trap 'exit 1;' SIGINT + # Need to be able to have non-root users read stuff (rpcbind etc) + chmod 755 "$initdir" + ++declare -A host_fs_types ++ + for line in "${fstab_lines[@]}"; do + set -- $line + #dev mp fs fsopts + push host_devs "$1" +- push host_fs_types "$1|$3" ++ host_fs_types["$1"]="$3" + done + + for f in $add_fstab; do +@@ -791,28 +793,27 @@ fi + _get_fs_type() ( + [[ $1 ]] || return + if [[ -b $1 ]] && get_fs_env $1; then +- echo "$(readlink -f $1)|$ID_FS_TYPE" ++ echo "$(readlink -f $1) $ID_FS_TYPE" + return 1 + fi + if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then +- echo "$(readlink -f /dev/block/$1)|$ID_FS_TYPE" ++ echo "$(readlink -f /dev/block/$1) $ID_FS_TYPE" + return 1 + fi + if fstype=$(find_dev_fstype $1); then +- echo "$1|$fstype" ++ echo "$1 $fstype" + return 1 + fi + return 1 + ) + + for dev in "${host_devs[@]}"; do +- unset fs_type +- for fstype in $(_get_fs_type $dev) \ +- $(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do +- if ! strstr " ${host_fs_types[*]} " " $fstype ";then +- push host_fs_types "$fstype" +- fi +- done ++ while read key val; do ++ host_fs_types["$key"]="$val" ++ done < <( ++ _get_fs_type $dev ++ check_block_and_slaves_all _get_fs_type $(get_maj_min $dev) ++ ) + done + + [[ -d $udevdir ]] \ +diff --git a/modules.d/90btrfs/module-setup.sh b/modules.d/90btrfs/module-setup.sh +index 0f79f5e..4a7c01d 100755 +--- a/modules.d/90btrfs/module-setup.sh ++++ b/modules.d/90btrfs/module-setup.sh +@@ -9,12 +9,10 @@ check() { + type -P btrfs >/dev/null || return 1 + + [[ $hostonly ]] || [[ $mount_needs ]] && { +- local _found + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|btrfs" && _found="1" ++ [[ "$fs" == "btrfs" ]] && return 0 + done +- [[ $_found ]] || return 1 +- unset _found ++ return 255 + } + + return 0 +diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh +index 2b4456b..b76f6ae 100755 +--- a/modules.d/90crypt/module-setup.sh ++++ b/modules.d/90crypt/module-setup.sh +@@ -7,8 +7,30 @@ check() { + # if cryptsetup is not installed, then we cannot support encrypted devices. + type -P cryptsetup >/dev/null || return 1 + ++ [[ $hostonly ]] || [[ $mount_needs ]] && { ++ for fs in "${host_fs_types[@]}"; do ++ [[ $fs = "crypto_LUKS" ]] && return 0 ++ done ++ return 255 ++ } ++ ++ return 0 ++} ++ ++depends() { ++ echo dm rootfs-block ++ return 0 ++} ++ ++installkernel() { ++ instmods dm_crypt =crypto ++} ++ ++install() { ++ + check_crypt() { + local dev=$1 fs=$2 ++ + [[ $fs = "crypto_LUKS" ]] || return 1 + ID_FS_UUID=$(udevadm info --query=property --name=$dev \ + | while read line; do +@@ -24,23 +46,8 @@ check() { + return 0 + } + +- [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_crypt || return 1 +- } +- +- return 0 +-} +- +-depends() { +- echo dm rootfs-block +- return 0 +-} +- +-installkernel() { +- instmods dm_crypt =crypto +-} ++ for_each_host_dev_fs check_crypt + +-install() { + dracut_install cryptsetup rmdir readlink umount + inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask + inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev +diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh +index c315961..76daa4a 100755 +--- a/modules.d/90dmraid/module-setup.sh ++++ b/modules.d/90dmraid/module-setup.sh +@@ -8,9 +8,27 @@ check() { + # in trying to support it in the initramfs. + type -P dmraid >/dev/null || return 1 + ++ [[ $hostonly ]] || [[ $mount_needs ]] && { ++ for fs in "${host_fs_types[@]}"; do ++ [[ $fs = *_raid_member ]] && return 0 ++ done ++ return 255 ++ } ++ ++ return 0 ++} ++ ++depends() { ++ echo dm rootfs-block ++ return 0 ++} ++ ++install() { ++ local _i ++ + check_dmraid() { + local dev=$1 fs=$2 holder DEVPATH DM_NAME +- [[ "$fs" = "${fs%%_raid_member}" ]] && return 1 ++ [[ "$fs" != *_raid_member ]] && return 1 + + DEVPATH=$(udevadm info --query=property --name=$dev \ + | while read line; do +@@ -37,20 +55,8 @@ check() { + return 0 + } + +- [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_dmraid || return 1 +- } ++ for_each_host_dev_fs check_dmraid + +- return 0 +-} +- +-depends() { +- echo dm rootfs-block +- return 0 +-} +- +-install() { +- local _i + dracut_install dmraid + dracut_install -o kpartx + inst $(command -v partx) /sbin/partx +diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh +index e0e4043..22186f4 100755 +--- a/modules.d/90lvm/module-setup.sh ++++ b/modules.d/90lvm/module-setup.sh +@@ -7,22 +7,11 @@ check() { + # No point trying to support lvm if the binaries are missing + type -P lvm >/dev/null || return 1 + +- check_lvm() { +- local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG +- eval $(udevadm info --query=property --name=/dev/block/$1|egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=') +- [[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1 +- [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1 +- if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then +- if ! [[ $kernel_only ]]; then +- echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf" +- fi +- push _activated "${DM_VG_NAME}/${DM_LV_NAME}" +- fi +- return 0 +- } +- + [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_lvm || return 1 ++ for fs in "${host_fs_types[@]}"; do ++ [[ $fs = LVM*_member ]] && return 0 ++ done ++ return 255 + } + + return 0 +@@ -38,6 +27,23 @@ install() { + local _i + inst lvm + ++ check_lvm() { ++ local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG ++ ++ eval $(udevadm info --query=property --name=$1 | egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=') ++ [[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1 ++ [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1 ++ if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then ++ if ! [[ $kernel_only ]]; then ++ echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf" ++ fi ++ push _activated "${DM_VG_NAME}/${DM_LV_NAME}" ++ fi ++ return 0 ++ } ++ ++ for_each_host_dev_fs check_lvm ++ + inst_rules "$moddir/64-lvm.rules" + + if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then +diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh +index 0efffbb..70c27dd 100755 +--- a/modules.d/90mdraid/module-setup.sh ++++ b/modules.d/90mdraid/module-setup.sh +@@ -7,27 +7,11 @@ check() { + # No mdadm? No mdraid support. + type -P mdadm >/dev/null || return 1 + +- check_mdraid() { +- local dev=$1 fs=$2 holder DEVPATH MD_UUID +- [[ "$fs" = "${fs%%_raid_member}" ]] && return 1 +- +- MD_UUID=$(/sbin/mdadm --examine --export $dev \ +- | while read line; do +- [[ ${line#MD_UUID} = $line ]] && continue +- eval "$line" +- echo $MD_UUID +- break +- done) +- +- [[ ${MD_UUID} ]] || return 1 +- if ! [[ $kernel_only ]]; then +- echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf" +- fi +- return 0 +- } +- + [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_mdraid || return 1 ++ for fs in "${host_fs_types[@]}"; do ++ [[ "$fs" == *_raid_member ]] && return 0 ++ done ++ return 255 + } + + return 0 +@@ -48,6 +32,27 @@ install() { + inst $(command -v partx) /sbin/partx + inst $(command -v mdadm) /sbin/mdadm + ++ check_mdraid() { ++ local dev=$1 fs=$2 holder DEVPATH MD_UUID ++ [[ "$fs" != *_raid_member ]] && return 1 ++ ++ MD_UUID=$(/sbin/mdadm --examine --export $dev \ ++ | while read line; do ++ [[ ${line#MD_UUID} = $line ]] && continue ++ eval "$line" ++ echo $MD_UUID ++ break ++ done) ++ ++ [[ ${MD_UUID} ]] || return 1 ++ if ! [[ $kernel_only ]]; then ++ echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf" ++ fi ++ return 0 ++ } ++ ++ for_each_host_dev_fs check_mdraid ++ + inst_rules 64-md-raid.rules + # remove incremental assembly from stock rules, so they don't shadow + # 65-md-inc*.rules and its fine-grained controls, or cause other problems +diff --git a/modules.d/95cifs/module-setup.sh b/modules.d/95cifs/module-setup.sh +index 1c7d0be..bf0eddf 100755 +--- a/modules.d/95cifs/module-setup.sh ++++ b/modules.d/95cifs/module-setup.sh +@@ -8,7 +8,7 @@ check() { + + [[ $hostonly ]] || [[ $mount_needs ]] && { + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|cifs" && return 0 ++ [[ "$fs" == "cifs" ]] && return 0 + done + return 255 + } +diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh +index 38ee5d7..7c3a64d 100755 +--- a/modules.d/95nfs/module-setup.sh ++++ b/modules.d/95nfs/module-setup.sh +@@ -9,9 +9,9 @@ check() { + + [[ $hostonly ]] || [[ $mount_needs ]] && { + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|nfs" && return 0 +- strstr "$fs" "\|nfs3" && return 0 +- strstr "$fs" "\|nfs4" && return 0 ++ [[ "$fs" == "nfs" ]] && return 0 ++ [[ "$fs" == "nfs3" ]] && return 0 ++ [[ "$fs" == "nfs4" ]] && return 0 + done + return 255 + } +diff --git a/modules.d/95virtfs/module-setup.sh b/modules.d/95virtfs/module-setup.sh +index 0b961a8..12bd354 100755 +--- a/modules.d/95virtfs/module-setup.sh ++++ b/modules.d/95virtfs/module-setup.sh +@@ -5,9 +5,9 @@ + check() { + [[ $hostonly ]] || [[ $mount_needs ]] && { + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|9p" && return 0 ++ [[ "$fs" == "9p" ]] && return 0 + done +- return 1 ++ return 255 + } + + if type -P systemd-detect-virt >/dev/null 2>&1; then +-- +1.8.1.4 + |