2002-06-13 22:14:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: devfs
|
|
|
|
# REQUIRE: LOGIN
|
2003-05-05 15:38:41 +00:00
|
|
|
# BEFORE: securelevel
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="devfs"
|
2003-08-20 06:15:18 +00:00
|
|
|
start_cmd='devfs_start'
|
2003-05-06 01:10:33 +00:00
|
|
|
stop_cmd=':'
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2003-08-20 06:15:18 +00:00
|
|
|
devfs_start()
|
|
|
|
{
|
2004-03-20 07:10:16 +00:00
|
|
|
if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then
|
2003-08-20 06:15:18 +00:00
|
|
|
devfs_init_rulesets
|
2004-03-20 07:10:16 +00:00
|
|
|
if [ -n "$devfs_system_ruleset" ]; then
|
|
|
|
devfs_set_ruleset $devfs_system_ruleset /dev
|
|
|
|
devfs_apply_ruleset $devfs_system_ruleset /dev
|
|
|
|
fi
|
|
|
|
if [ -n "$devfs_set_rulesets" ]; then
|
|
|
|
local _dir_set
|
|
|
|
local _dir
|
|
|
|
local _set
|
|
|
|
for _dir_set in $devfs_set_rulesets; do
|
|
|
|
_dir=${_dir_set%=*}
|
|
|
|
_set=${_dir_set#*=}
|
|
|
|
devfs_set_ruleset $_set $_dir
|
|
|
|
devfs_apply_ruleset $_set $_dir
|
|
|
|
done
|
|
|
|
fi
|
2003-08-20 06:15:18 +00:00
|
|
|
fi
|
|
|
|
read_devfs_conf
|
|
|
|
}
|
|
|
|
|
2003-05-06 01:10:33 +00:00
|
|
|
read_devfs_conf()
|
|
|
|
{
|
|
|
|
if [ -r /etc/devfs.conf ]; then
|
|
|
|
cd /dev
|
|
|
|
while read action device parameter; do
|
|
|
|
case "${action}" in
|
|
|
|
l*) if [ -c ${device} -a ! -e ${parameter} ]; then
|
|
|
|
ln -fs ${device} ${parameter}
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
o*) if [ -c ${device} ]; then
|
|
|
|
chown ${parameter} ${device}
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
p*) if [ -c ${device} ]; then
|
|
|
|
chmod ${parameter} ${device}
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done < /etc/devfs.conf
|
|
|
|
fi
|
|
|
|
}
|
2003-05-02 08:10:58 +00:00
|
|
|
|
2003-05-06 01:10:33 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|