devfs revision 202880
198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $FreeBSD: head/etc/rc.d/devfs 202880 2010-01-23 11:42:31Z kib $ 498184Sgordon# 598184Sgordon 698184Sgordon# PROVIDE: devfs 7153298Sdougb# REQUIRE: mountcritremote 8136803Smtm# BEFORE: SERVERS 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 44154637Smatteo while read action devicelist parameter; do 45114769Sdougb case "${action}" in 46154637Smatteo l*) for device in ${devicelist}; do 47202880Skib if [ ! -e ${parameter} ]; then 48154637Smatteo ln -fs ${device} ${parameter} 49154637Smatteo fi 50154637Smatteo done 51114769Sdougb ;; 52154637Smatteo o*) for device in ${devicelist}; do 53154637Smatteo if [ -c ${device} ]; then 54154637Smatteo chown ${parameter} ${device} 55154637Smatteo fi 56154637Smatteo done 57114769Sdougb ;; 58154637Smatteo p*) for device in ${devicelist}; do 59154637Smatteo if [ -c ${device} ]; then 60154637Smatteo chmod ${parameter} ${device} 61154637Smatteo fi 62154637Smatteo done 63114769Sdougb ;; 64114769Sdougb esac 65114769Sdougb done < /etc/devfs.conf 66114769Sdougb fi 67114769Sdougb} 68114769Sdougb 6998184Sgordonload_rc_config $name 70114769Sdougbrun_rc_command "$1" 71