devfs revision 180563
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/devfs 180563 2008-07-16 19:22:48Z dougb $ 4# 5 6# PROVIDE: devfs 7# REQUIRE: 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 devicelist parameter; do 45 case "${action}" in 46 l*) for device in ${devicelist}; do 47 if [ -c ${device} -a ! -e ${parameter} ]; then 48 ln -fs ${device} ${parameter} 49 fi 50 done 51 ;; 52 o*) for device in ${devicelist}; do 53 if [ -c ${device} ]; then 54 chown ${parameter} ${device} 55 fi 56 done 57 ;; 58 p*) for device in ${devicelist}; do 59 if [ -c ${device} ]; then 60 chmod ${parameter} ${device} 61 fi 62 done 63 ;; 64 esac 65 done < /etc/devfs.conf 66 fi 67} 68 69load_rc_config $name 70run_rc_command "$1" 71