--- rc.sysinit.orig 2005-04-01 19:36:49 +0400 +++ rc.sysinit 2005-04-10 04:44:10 +0400 @@ -285,11 +285,42 @@ 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 - +mdadm_found() { + [ -s /etc/mdadm.conf ] || return 1 + for f in /sbin/mdadm /usr/sbin/mdadm /sbin/mdassemble /usr/sbin/mdassemble; do + [ -x "$f" ] && return 0 + done + return 1 +} + +raid_helpers_found() { + mdadm_found && return 0 + [ -s /etc/raidtab ] && return 0 + return 1 +} + +mount_raid_using_mdadm() { + [ -s /etc/mdadm.conf ] || return 1 + for f in /sbin/mdadm /usr/sbin/mdadm; do + [ -x "$f" ] || continue + echo -n "(using mdadm) " + "$f" --assemble --scan + return $? + done + for f in /sbin/mdassemble /usr/sbin/mdassemble; do + [ -x "$f" ] || continue + echo -n "(using mdassemble) " + "$f" + return $? + done + return 1 +} + +mount_raid_using_raidtools() { + local rc=0 + [ -s /etc/raidtab ] || return 1 + echo -n "(using raidtools) " for i in `grep -s "^raiddev" /etc/raidtab | awk '{print $2}'`; do RAIDDEV="${i##*/}" RAIDSTAT=`grep -s "^$RAIDDEV : active" /proc/mdstat` @@ -315,6 +346,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.