devfs revision 136224
198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $FreeBSD: head/etc/rc.d/devfs 136224 2004-10-07 13:55:26Z mtm $ 498184Sgordon# 598184Sgordon 698184Sgordon# PROVIDE: devfs 798184Sgordon# REQUIRE: LOGIN 8114735Smtm# BEFORE: securelevel 9136224Smtm# KEYWORD: nojail 1098184Sgordon 1198184Sgordon. /etc/rc.subr 1298184Sgordon 1398184Sgordonname="devfs" 14119166Smtmstart_cmd='devfs_start' 15114769Sdougbstop_cmd=':' 1698184Sgordon 17119166Smtmdevfs_start() 18119166Smtm{ 19127222Sgreen if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then 20119166Smtm devfs_init_rulesets 21127222Sgreen if [ -n "$devfs_system_ruleset" ]; then 22127222Sgreen devfs_set_ruleset $devfs_system_ruleset /dev 23127222Sgreen devfs_apply_ruleset $devfs_system_ruleset /dev 24127222Sgreen fi 25127222Sgreen if [ -n "$devfs_set_rulesets" ]; then 26127222Sgreen local _dir_set 27127222Sgreen local _dir 28127222Sgreen local _set 29127222Sgreen for _dir_set in $devfs_set_rulesets; do 30127222Sgreen _dir=${_dir_set%=*} 31127222Sgreen _set=${_dir_set#*=} 32127222Sgreen devfs_set_ruleset $_set $_dir 33127222Sgreen devfs_apply_ruleset $_set $_dir 34127222Sgreen done 35127222Sgreen fi 36119166Smtm fi 37119166Smtm read_devfs_conf 38119166Smtm} 39119166Smtm 40114769Sdougbread_devfs_conf() 41114769Sdougb{ 42114769Sdougb if [ -r /etc/devfs.conf ]; then 43114769Sdougb cd /dev 44114769Sdougb while read action device parameter; do 45114769Sdougb case "${action}" in 46114769Sdougb l*) if [ -c ${device} -a ! -e ${parameter} ]; then 47114769Sdougb ln -fs ${device} ${parameter} 48114769Sdougb fi 49114769Sdougb ;; 50114769Sdougb o*) if [ -c ${device} ]; then 51114769Sdougb chown ${parameter} ${device} 52114769Sdougb fi 53114769Sdougb ;; 54114769Sdougb p*) if [ -c ${device} ]; then 55114769Sdougb chmod ${parameter} ${device} 56114769Sdougb fi 57114769Sdougb ;; 58114769Sdougb esac 59114769Sdougb done < /etc/devfs.conf 60114769Sdougb fi 61114769Sdougb} 62114769Sdougb 6398184Sgordonload_rc_config $name 64114769Sdougbrun_rc_command "$1" 65