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/90dmraid | |
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/90dmraid')
-rwxr-xr-x | modules.d/90dmraid/module-setup.sh | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh index 87a4d1ef..9de6c634 100755 --- a/modules.d/90dmraid/module-setup.sh +++ b/modules.d/90dmraid/module-setup.sh @@ -11,19 +11,37 @@ check() { . $dracutfunctions [[ $debug ]] && set -x - is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \ - grep -q _raid_member; } + check_dmraid() { + local dev=$1 fs=$2 holder DEVPATH DM_NAME + [[ "$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 + DM_NAME=$(udevadm info --query=property --path=$holder \ + | while read line; do + [[ ${line#DM_NAME} = $line ]] && continue + eval "$line" + echo $DM_NAME + break + done) + done + + [[ ${DM_NAME} ]] || continue + echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.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_dmraid "$_rootdev" || return 1 - else - # root is not on a block device, use the shotgun approach - dmraid -r | grep -q ok || return 1 - fi + [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d" + for_each_host_dev_fs check_dmraid + [ -f "${initdir}/etc/cmdline.d/90dmraid.conf" ] || return 1 } return 0 |