summaryrefslogtreecommitdiff
path: root/pcr/openrc-base/mdraid.rc
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/openrc-base/mdraid.rc')
-rw-r--r--pcr/openrc-base/mdraid.rc40
1 files changed, 40 insertions, 0 deletions
diff --git a/pcr/openrc-base/mdraid.rc b/pcr/openrc-base/mdraid.rc
new file mode 100644
index 000000000..27421e26e
--- /dev/null
+++ b/pcr/openrc-base/mdraid.rc
@@ -0,0 +1,40 @@
+#!/sbin/runscript
+# Copyright 1999-2011 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 $
+
+depend() {
+ before checkfs fsck
+ after modules
+}
+
+start() {
+ local output
+
+ ebegin "Starting up RAID devices"
+ output=$(mdadm -As 2>&1)
+ eend $? "${output}"
+
+ 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
+ fi
+
+ return 0
+}
+
+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}"
+}