11.1Slukem#!/bin/sh 21.1Slukem# 31.12Skre# $NetBSD: raidframe,v 1.12 2022/07/21 07:49:36 kre Exp $ 41.1Slukem# 51.1Slukem 61.10Sjoerg# PROVIDE: raidframe 71.11Smlelstv# REQUIRE: devpubd 81.10Sjoerg# BEFORE: DISKS 91.1Slukem 101.9Smycroft$_rc_subr_loaded . /etc/rc.subr 111.1Slukem 121.12Skrename=raidframe 131.8Swizrcvar=$name 141.12Skrestart_cmd=raidframe_start 151.12Skrestop_cmd=: 161.1Slukem 171.1Slukemraidframe_start() 181.1Slukem{ 191.6Slukem # Configure non-auto-configured raid devices. 201.12Skre # Ensure order by globbing raid[0-9] before raid[1-9][0-9]. 211.12Skre # Assume no mixing of /etc/conf/raid/* and /etc/raid*.conf styles 221.12Skre 231.12Skre devices=$(sysctl -n hw.disknames) 241.12Skre for cfg in \ 251.12Skre /etc/conf/raid/raid[0-9] \ 261.12Skre /etc/conf/raid/raid[1-9][0-9] \ 271.12Skre /etc/conf/raid/raid[1-9][0-9][0-9] \ 281.12Skre /etc/raid[0-9].conf \ 291.12Skre /etc/raid[1-9][0-9].conf \ 301.12Skre ; do 311.12Skre [ -f "$cfg" ] && [ -s "$cfg" ] || continue 321.12Skre 331.5Slukem dev=${cfg##*/} 341.12Skre dev=${dev%.conf} 351.12Skre 361.12Skre # This test should never fail with the possible 371.12Skre # config file patterns included, but for safety 381.12Skre case "${dev}" in 391.12Skre raid[0-9]|raid[1-9][0-9]|raid[1-9][0-9][0-9]) ;; 401.12Skre *) : "$dev not raidNN"; continue;; 411.12Skre esac 421.12Skre 431.12Skre case " ${devices} " in 441.12Skre *" ${dev} "*) : "$dev configured already"; continue;; 451.12Skre esac 461.12Skre 471.12Skre raidctl -c "$cfg" "$dev" && 481.12Skre devices="${devices} ${dev}" 491.1Slukem done 501.1Slukem} 511.1Slukem 521.3Slukemload_rc_config $name 531.1Slukemrun_rc_command "$1" 54