summaryrefslogtreecommitdiff
path: root/nonsystemd/mdadm-openrc/mdraid.initd
diff options
context:
space:
mode:
Diffstat (limited to 'nonsystemd/mdadm-openrc/mdraid.initd')
-rw-r--r--nonsystemd/mdadm-openrc/mdraid.initd39
1 files changed, 39 insertions, 0 deletions
diff --git a/nonsystemd/mdadm-openrc/mdraid.initd b/nonsystemd/mdadm-openrc/mdraid.initd
new file mode 100644
index 000000000..84fc0aa03
--- /dev/null
+++ b/nonsystemd/mdadm-openrc/mdraid.initd
@@ -0,0 +1,39 @@
+#!/usr/bin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before checkfs fsck
+ after modules
+}
+
+start() {
+ local output
+
+ ebegin "Starting up RAID devices"
+ output=$(mdadm -As ${MDADM_ASSEMBLE_OPTS} 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}"
+}