summaryrefslogtreecommitdiff
blob: 327b89ef1b7b7b5516ec7a092f9ab7b49a4828fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

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}"
}