From c2a6ce4622970c4f55d17addee14497a9d34eb28 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 19 May 2005 03:14:36 +0000 Subject: dont run if no devices exist --- sys-fs/mdadm/files/raid-start.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'sys-fs/mdadm/files') diff --git a/sys-fs/mdadm/files/raid-start.sh b/sys-fs/mdadm/files/raid-start.sh index 1e1985b39a23..c2edc03aa1dd 100755 --- a/sys-fs/mdadm/files/raid-start.sh +++ b/sys-fs/mdadm/files/raid-start.sh @@ -1,5 +1,7 @@ # /lib/rcscripts/addons/raid-start.sh: Setup raid volumes at boot -# $Header: /var/cvsroot/gentoo-x86/sys-fs/mdadm/files/raid-start.sh,v 1.1 2005/03/02 04:32:07 vapier Exp $ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/mdadm/files/raid-start.sh,v 1.2 2005/05/19 03:14:36 vapier Exp $ [[ -f /proc/mdstat ]] || exit 0 @@ -19,22 +21,28 @@ create_devs() { # Start software raid with raidtools (old school) if [[ -x /sbin/raidstart && -f /etc/raidtab ]] ; then - create_devs $(awk '/^[[:space:]]*raiddev/ { print $2 }' /etc/raidtab) - ebegin "Starting up RAID devices (raidtools)" - output=$(raidstart -a 2>&1) - ret=$? - [[ ${ret} -ne 0 ]] && echo "${output}" - eend ${ret} + devs=$(awk '/^[[:space:]]*raiddev/ { print $2 }' /etc/raidtab) + if [[ -n ${devs} ]] ; then + create_devs ${devs} + ebegin "Starting up RAID devices (raidtools)" + output=$(raidstart -a 2>&1) + ret=$? + [[ ${ret} -ne 0 ]] && echo "${output}" + eend ${ret} + fi fi # Start software raid with mdadm (new school) if [[ -x /sbin/mdadm && -f /etc/mdadm.conf ]] ; then - create_devs $(awk '/^[[:space:]]*ARRAY/ { print $2 }' /etc/mdadm.conf) - ebegin "Starting up RAID devices (mdadm)" - output=$(mdadm -As 2>&1) - ret=$? - [[ ${ret} -ne 0 ]] && echo "${output}" - eend ${ret} + devs=$(awk '/^[[:space:]]*ARRAY/ { print $2 }' /etc/mdadm.conf) + if [[ -n ${devs} ]] ; then + create_devs ${devs} + ebegin "Starting up RAID devices (mdadm)" + output=$(mdadm -As 2>&1) + ret=$? + [[ ${ret} -ne 0 ]] && echo "${output}" + eend ${ret} + fi fi # vim:ts=4 -- cgit v1.2.3-65-gdbad