diff options
author | Harald Hoyer <harald@redhat.com> | 2011-12-08 10:43:29 +0100 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2011-12-15 14:49:03 +0100 |
commit | 480d772f22a2f690928c59c7c0ebfa7dc00332ea (patch) | |
tree | 1decbfceb0d963841eb3a094d481720eb048389c /modules.d/90mdraid | |
parent | 7ae5d9d11d1a0ccd31dced528e2792f1c1d5aeca (diff) | |
download | dracut-480d772f22a2f690928c59c7c0ebfa7dc00332ea.tar.gz dracut-480d772f22a2f690928c59c7c0ebfa7dc00332ea.tar.bz2 dracut-480d772f22a2f690928c59c7c0ebfa7dc00332ea.zip |
*/module-setup.sh: use host_fs_types host_devs
For the $hostonly case, use $host_fs_types and $host_devs to determine,
if a module has to be included in the initramfs.
Diffstat (limited to 'modules.d/90mdraid')
-rwxr-xr-x | modules.d/90mdraid/module-setup.sh | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh index 029d667b..05e01279 100755 --- a/modules.d/90mdraid/module-setup.sh +++ b/modules.d/90mdraid/module-setup.sh @@ -10,18 +10,38 @@ check() { . $dracutfunctions [[ $debug ]] && set -x - is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; } + check_mdraid() { + local dev=$1 fs=$2 holder DEVPATH MD_UUID + [[ "$fs" = "linux_raid_member" ]] && continue + [[ "$fs" = "${fs%%_raid_member}" ]] && continue + + DEVPATH=$(udevadm info --query=property --name=$dev \ + | while read line; do + [[ ${line#DEVPATH} = $line ]] && continue + eval "$line" + echo $DEVPATH + break + done) + + for holder in /sys/$DEVPATH/holders/*; do + [[ -e $holder ]] || continue + MD_UUID=$(udevadm info --query=property --path=$holder \ + | while read line; do + [[ ${line#MD_UUID} = $line ]] && continue + eval "$line" + echo $MD_UUID + break + done) + done + + [[ ${MD_UUID} ]] || continue + echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf" + } [[ $hostonly ]] && { - _rootdev=$(find_root_block_device) - if [[ $_rootdev ]]; then - # root lives on a block device, so we can be more precise about - # hostonly checking - check_block_and_slaves is_mdraid "$_rootdev" || return 1 - else - # root is not on a block device, use the shotgun approach - blkid | egrep -q '(linux|isw|ddf)_raid' || return 1 - fi + [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d" + for_each_host_dev_fs check_mdraid + [[ -f "${initdir}/etc/cmdline.d/90mdraid.conf" ]] || return 1 } return 0 |