devfs revision 231194
198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $FreeBSD: head/etc/rc.d/devfs 231194 2012-02-08 08:52:40Z dougb $ 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{ 19231194Sdougb if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ] || 20231194Sdougb checkyesno devfs_load_rulesets; then 21119166Smtm devfs_init_rulesets 22127222Sgreen if [ -n "$devfs_system_ruleset" ]; then 23127222Sgreen devfs_set_ruleset $devfs_system_ruleset /dev 24127222Sgreen devfs_apply_ruleset $devfs_system_ruleset /dev 25127222Sgreen fi 26127222Sgreen if [ -n "$devfs_set_rulesets" ]; then 27127222Sgreen local _dir_set 28127222Sgreen local _dir 29127222Sgreen local _set 30127222Sgreen for _dir_set in $devfs_set_rulesets; do 31127222Sgreen _dir=${_dir_set%=*} 32127222Sgreen _set=${_dir_set#*=} 33127222Sgreen devfs_set_ruleset $_set $_dir 34127222Sgreen devfs_apply_ruleset $_set $_dir 35127222Sgreen done 36127222Sgreen fi 37119166Smtm fi 38119166Smtm read_devfs_conf 39119166Smtm} 40119166Smtm 41114769Sdougbread_devfs_conf() 42114769Sdougb{ 43114769Sdougb if [ -r /etc/devfs.conf ]; then 44114769Sdougb cd /dev 45154637Smatteo while read action devicelist parameter; do 46114769Sdougb case "${action}" in 47154637Smatteo l*) for device in ${devicelist}; do 48202880Skib if [ ! -e ${parameter} ]; then 49154637Smatteo ln -fs ${device} ${parameter} 50154637Smatteo fi 51154637Smatteo done 52114769Sdougb ;; 53154637Smatteo o*) for device in ${devicelist}; do 54154637Smatteo if [ -c ${device} ]; then 55154637Smatteo chown ${parameter} ${device} 56154637Smatteo fi 57154637Smatteo done 58114769Sdougb ;; 59154637Smatteo p*) for device in ${devicelist}; do 60154637Smatteo if [ -c ${device} ]; then 61154637Smatteo chmod ${parameter} ${device} 62154637Smatteo fi 63154637Smatteo done 64114769Sdougb ;; 65114769Sdougb esac 66114769Sdougb done < /etc/devfs.conf 67114769Sdougb fi 68114769Sdougb} 69114769Sdougb 7098184Sgordonload_rc_config $name 71114769Sdougbrun_rc_command "$1" 72