2011-02-02 15:34:58 +03:00
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check( ) {
2011-05-12 13:03:30 +04:00
local _rootdev
2011-02-02 15:34:58 +03:00
# if we don't have dmraid installed on the host system, no point
# in trying to support it in the initramfs.
type -P dmraid >/dev/null || return 1
. $dracutfunctions
[ [ $debug ] ] && set -x
2011-12-08 13:43:29 +04:00
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 "
}
2011-02-02 15:34:58 +03:00
2011-12-20 10:09:57 +04:00
[ [ $hostonly ] ] || [ [ $mount_needs ] ] && {
2011-12-08 13:43:29 +04:00
[ [ -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
2011-02-02 15:34:58 +03:00
}
return 0
}
depends( ) {
echo dm rootfs-block
return 0
}
install( ) {
2011-05-12 13:03:30 +04:00
local _i
2011-05-10 13:39:10 +04:00
dracut_install dmraid partx kpartx
2011-02-02 15:34:58 +03:00
inst " $moddir /dmraid.sh " /sbin/dmraid_scan
if [ ! -x /lib/udev/vol_id ] ; then
inst_rules 64-md-raid.rules
fi
2011-11-09 17:24:59 +04:00
for _i in { " $libdir " ," $usrlibdir " } /libdmraid-events*.so*; do
[ -e " $_i " ] && dracut_install " $_i "
done
2011-02-02 15:34:58 +03:00
inst_rules " $moddir /61-dmraid-imsm.rules "
2011-08-12 15:13:06 +04:00
#inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
2011-02-02 15:34:58 +03:00
inst_hook pre-trigger 30 " $moddir /parse-dm.sh "
}