xref: /netbsd/etc/rc.d/raidframe (revision bf9ec67e)
1#!/bin/sh
2#
3# $NetBSD: raidframe,v 1.6 2002/01/27 14:16:33 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 non-auto-configured 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, in the background.
27	#
28	(
29		for dev in `sysctl -n hw.disknames`; do
30			case $dev in
31			raid[0-9]*)
32				raidctl -P $dev
33				;;
34			esac
35		done
36	) &
37}
38
39load_rc_config $name
40run_rc_command "$1"
41