--- rc.sysinit.orig 2005-04-01 19:36:49 +0400 +++ rc.sysinit.orig 2005-04-04 12:14:32 +0400 @@ -285,11 +285,26 @@ fi # Add raid devices -if [ -z "$EVMS_ACTIVE" ] && [ -f /proc/mdstat -a -s /etc/raidtab ] && ! grep -iwqs noraidtab /proc/cmdline; then - echo -n "Starting up RAID devices: " - rc=0 - +raid_helpers_found() { + [ -s /etc/mdadm.conf ] && [ -x /sbin/mdadm -o -x /usr/sbin/mdadm ] && return 0 + [ -s /etc/raidtab ] && return 0 + return 1 +} + +mount_raid_using_mdadm() { + local MDADM=/sbin/mdadm + [ -s /etc/mdadm.conf ] || return 1 + if [ ! -x "$MDADM" ]; then + MDADM=/usr/sbin/mdadm + [ -x "$MDADM" ] || return 1 + fi + "$MDADM" --assemble --scan +} + +mount_raid_using_raidtools() { + local rc=0 + [ -s /etc/raidtab ] || return 1 for i in `grep -s "^raiddev" /etc/raidtab | awk '{print $2}'`; do RAIDDEV="${i##*/}" RAIDSTAT=`grep -s "^$RAIDDEV : active" /proc/mdstat` @@ -315,6 +330,14 @@ fi echo -n "$RAIDDEV " done + return $rc +} + +if [ -z "$EVMS_ACTIVE" ] && [ -f /proc/mdstat ] && raid_helpers_found && ! grep -iwqs noraidtab /proc/cmdline; then + + echo -n "Starting up RAID devices: " + rc=0 + mount_raid_using_mdadm || mount_raid_using_raidtools || rc=1 echo # A non-zero return means there were problems.