xref: /netbsd-src/etc/rc.d/raidframe (revision 27578b9aac214cc7796ead81dcc5427e79d5f2a0)
1#!/bin/sh
2#
3# $NetBSD: raidframe,v 1.5 2000/11/17 05:43:46 lukem Exp $
4#
5
6# PROVIDE: disks
7
8. /etc/rc.subr
9
10name="raidframe"
11start_cmd="raidframe_start"
12stop_cmd=":"
13
14raidframe_start()
15{
16	# Configure raid devices.
17	# Ensure order by globbing raid[0-9].conf before raid[0-9][0-9].conf.
18	#
19	for cfg in /etc/raid[0-9].conf /etc/raid[0-9][0-9].conf ; do
20		[ ! -f $cfg ] && continue
21		dev=${cfg##*/}
22		dev=${dev%%.conf}
23		raidctl -c $cfg $dev
24	done
25
26	# Initiate parity/mirror reconstruction as needed.
27	# Backgrounded, and sequentially ordered.
28	#
29	# XXX:	this currently doesn't work for autoconfigured raid devices
30	#	that don't have a corresponding raidN.conf
31	#
32	(
33		for cfg in /etc/raid[0-9].conf /etc/raid[0-9][0-9].conf ; do
34			[ ! -f $cfg ] && continue
35			dev=${cfg##*/}
36			dev=${dev%%.conf}
37			raidctl -P $dev
38		done
39	) &
40}
41
42load_rc_config $name
43run_rc_command "$1"
44