devfs revision 136803
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/devfs 136803 2004-10-23 06:50:50Z mtm $ 4# 5 6# PROVIDE: devfs 7# REQUIRE: rcconf mountcritremote 8# BEFORE: SERVERS securelevel 9# KEYWORD: nojail 10 11. /etc/rc.subr 12 13name="devfs" 14start_cmd='devfs_start' 15stop_cmd=':' 16 17devfs_start() 18{ 19 if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then 20 devfs_init_rulesets 21 if [ -n "$devfs_system_ruleset" ]; then 22 devfs_set_ruleset $devfs_system_ruleset /dev 23 devfs_apply_ruleset $devfs_system_ruleset /dev 24 fi 25 if [ -n "$devfs_set_rulesets" ]; then 26 local _dir_set 27 local _dir 28 local _set 29 for _dir_set in $devfs_set_rulesets; do 30 _dir=${_dir_set%=*} 31 _set=${_dir_set#*=} 32 devfs_set_ruleset $_set $_dir 33 devfs_apply_ruleset $_set $_dir 34 done 35 fi 36 fi 37 read_devfs_conf 38} 39 40read_devfs_conf() 41{ 42 if [ -r /etc/devfs.conf ]; then 43 cd /dev 44 while read action device parameter; do 45 case "${action}" in 46 l*) if [ -c ${device} -a ! -e ${parameter} ]; then 47 ln -fs ${device} ${parameter} 48 fi 49 ;; 50 o*) if [ -c ${device} ]; then 51 chown ${parameter} ${device} 52 fi 53 ;; 54 p*) if [ -c ${device} ]; then 55 chmod ${parameter} ${device} 56 fi 57 ;; 58 esac 59 done < /etc/devfs.conf 60 fi 61} 62 63load_rc_config $name 64run_rc_command "$1" 65