devfs revision 136803
11573Srgrimes#!/bin/sh 21573Srgrimes# 31573Srgrimes# $FreeBSD: head/etc/rc.d/devfs 136803 2004-10-23 06:50:50Z mtm $ 41573Srgrimes# 51573Srgrimes 61573Srgrimes# PROVIDE: devfs 71573Srgrimes# REQUIRE: rcconf mountcritremote 81573Srgrimes# BEFORE: SERVERS securelevel 91573Srgrimes# KEYWORD: nojail 101573Srgrimes 111573Srgrimes. /etc/rc.subr 121573Srgrimes 131573Srgrimesname="devfs" 141573Srgrimesstart_cmd='devfs_start' 151573Srgrimesstop_cmd=':' 16249808Semaste 171573Srgrimesdevfs_start() 181573Srgrimes{ 191573Srgrimes if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then 201573Srgrimes devfs_init_rulesets 211573Srgrimes if [ -n "$devfs_system_ruleset" ]; then 221573Srgrimes devfs_set_ruleset $devfs_system_ruleset /dev 231573Srgrimes devfs_apply_ruleset $devfs_system_ruleset /dev 241573Srgrimes fi 251573Srgrimes if [ -n "$devfs_set_rulesets" ]; then 261573Srgrimes local _dir_set 271573Srgrimes local _dir 281573Srgrimes local _set 291573Srgrimes for _dir_set in $devfs_set_rulesets; do 301573Srgrimes _dir=${_dir_set%=*} 311573Srgrimes _set=${_dir_set#*=} 321573Srgrimes devfs_set_ruleset $_set $_dir 331573Srgrimes devfs_apply_ruleset $_set $_dir 341573Srgrimes done 351573Srgrimes fi 3692986Sobrien fi 3792986Sobrien read_devfs_conf 381573Srgrimes} 3971579Sdeischen 401573Srgrimesread_devfs_conf() 4171579Sdeischen{ 42101776Stjr if [ -r /etc/devfs.conf ]; then 4335129Sjb cd /dev 441573Srgrimes while read action device parameter; do 45178778Sjhb case "${action}" in 46178778Sjhb l*) if [ -c ${device} -a ! -e ${parameter} ]; then 47178778Sjhb ln -fs ${device} ${parameter} 481573Srgrimes fi 491573Srgrimes ;; 501573Srgrimes o*) if [ -c ${device} ]; then 5113545Sjulian chown ${parameter} ${device} 52249810Semaste fi 531573Srgrimes ;; 5413545Sjulian p*) if [ -c ${device} ]; then 5592889Sobrien chmod ${parameter} ${device} 561573Srgrimes fi 5735129Sjb ;; 58127198Stjr esac 59127198Stjr done < /etc/devfs.conf 6013545Sjulian fi 6135129Sjb} 6213545Sjulian 631573Srgrimesload_rc_config $name 64178721Sjhbrun_rc_command "$1" 65178721Sjhb