#!/sbin/runscript
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/mdadm/files/mdraid.rc,v 1.6 2011/11/12 21:06:44 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/mdadm/files/mdraid.rc-3.1.1,v 1.1 2010/01/24 22:20:57 robbat2 Exp $
depend() {
- before checkfs fsck
- after modules
+ if [ ! -e /sbin/functions.sh ] ; then
+ # on baselayout-1 this could cause
+ # dependency-cycles with checkroot (before *)
+ before checkfs fsck
+ after modules
+ fi
}
-start() {
- local output
-
- ebegin "Starting up RAID devices"
- output=$(mdadm -As 2>&1)
- eend $? "${output}"
+run_addon() {
+ local f=/lib64/rcscripts/addons/$1.sh
+ if [ -r "$f" ]; then
+ ( . "$f" )
+ fi
+}
+start_addon() {
+ run_addon "$1"-start
+}
+stop_addon() {
+ run_addon "$1"-stop
+}
- local pat="/dev/md_d*"
- set -- ${pat}
- if [ "$*" != "${pat}" ] ; then
- ebegin "Creating RAID device partitions"
- blockdev "$@"
- eend $?
- # wait because vgscan runs next, and we want udev to fire
- sleep 1
+start() {
+ if [ -e /sbin/functions.sh ] ; then
+ eerror "The ${SVCNAME} init script is written for baselayout-2"
+ eerror "Please do not use it with baselayout-1"
+ return 1
fi
- return 0
+ start_addon raid
}
stop() {
- local output
-
- # XXX: Maybe drop this check ?
- [ ! -e /etc/mdadm/mdadm.conf ] && [ ! -e /etc/mdadm.conf ] && return 0
-
- ebegin "Shutting down RAID devices (mdadm)"
- output=$(mdadm -Ss 2>&1)
- eend $? "${output}"
+ stop_addon raid
}
# When used in --follow (aka --monitor) mode, mdadm needs a
# mail address and/or a program. This can be given with "mailaddr"
# and "program" lines to that monitoring can be started using
-# mdadm --follow --scan & echo $! > /run/mdadm/mon.pid
+# mdadm --follow --scan & echo $! > /var/run/mdadm
# If the lines are not found, mdadm will exit quietly
#MAILADDR root@mydomain.tld
#PROGRAM /usr/sbin/handle-mdadm-events