198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $FreeBSD: releng/11.0/etc/rc.d/devfs 298514 2016-04-23 16:10:54Z lme $ 498184Sgordon# 598184Sgordon 698184Sgordon# PROVIDE: devfs 7153298Sdougb# REQUIRE: mountcritremote 8136803Smtm# BEFORE: SERVERS securelevel 9136224Smtm# KEYWORD: nojail 1098184Sgordon 1198184Sgordon. /etc/rc.subr 1298184Sgordon 1398184Sgordonname="devfs" 14298514Slmedesc="Device filesystem" 15119166Smtmstart_cmd='devfs_start' 16114769Sdougbstop_cmd=':' 1798184Sgordon 18119166Smtmdevfs_start() 19119166Smtm{ 20231194Sdougb if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ] || 21231194Sdougb checkyesno devfs_load_rulesets; then 22119166Smtm devfs_init_rulesets 23127222Sgreen if [ -n "$devfs_system_ruleset" ]; then 24127222Sgreen devfs_set_ruleset $devfs_system_ruleset /dev 25127222Sgreen devfs_apply_ruleset $devfs_system_ruleset /dev 26127222Sgreen fi 27127222Sgreen if [ -n "$devfs_set_rulesets" ]; then 28127222Sgreen local _dir_set 29127222Sgreen local _dir 30127222Sgreen local _set 31127222Sgreen for _dir_set in $devfs_set_rulesets; do 32127222Sgreen _dir=${_dir_set%=*} 33127222Sgreen _set=${_dir_set#*=} 34127222Sgreen devfs_set_ruleset $_set $_dir 35127222Sgreen devfs_apply_ruleset $_set $_dir 36127222Sgreen done 37127222Sgreen fi 38119166Smtm fi 39119166Smtm read_devfs_conf 40119166Smtm} 41119166Smtm 42114769Sdougbread_devfs_conf() 43114769Sdougb{ 44114769Sdougb if [ -r /etc/devfs.conf ]; then 45114769Sdougb cd /dev 46154637Smatteo while read action devicelist parameter; do 47114769Sdougb case "${action}" in 48154637Smatteo l*) for device in ${devicelist}; do 49202880Skib if [ ! -e ${parameter} ]; then 50154637Smatteo ln -fs ${device} ${parameter} 51154637Smatteo fi 52154637Smatteo done 53114769Sdougb ;; 54154637Smatteo o*) for device in ${devicelist}; do 55154637Smatteo if [ -c ${device} ]; then 56154637Smatteo chown ${parameter} ${device} 57154637Smatteo fi 58154637Smatteo done 59114769Sdougb ;; 60154637Smatteo p*) for device in ${devicelist}; do 61154637Smatteo if [ -c ${device} ]; then 62154637Smatteo chmod ${parameter} ${device} 63154637Smatteo fi 64154637Smatteo done 65114769Sdougb ;; 66114769Sdougb esac 67114769Sdougb done < /etc/devfs.conf 68114769Sdougb fi 69114769Sdougb} 70114769Sdougb 7198184Sgordonload_rc_config $name 72114769Sdougbrun_rc_command "$1" 73