2002-06-13 22:14:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: devfs
|
2005-12-10 20:21:46 +00:00
|
|
|
# REQUIRE: mountcritremote
|
2004-10-23 06:50:50 +00:00
|
|
|
# BEFORE: SERVERS securelevel
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="devfs"
|
2016-04-23 16:10:54 +00:00
|
|
|
desc="Device filesystem"
|
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()
|
|
|
|
{
|
2012-02-08 08:52:40 +00:00
|
|
|
if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ] ||
|
|
|
|
checkyesno devfs_load_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
|
2006-01-21 14:31:45 +00:00
|
|
|
while read action devicelist parameter; do
|
2003-05-06 01:10:33 +00:00
|
|
|
case "${action}" in
|
2006-01-21 14:31:45 +00:00
|
|
|
l*) for device in ${devicelist}; do
|
2010-01-23 11:42:31 +00:00
|
|
|
if [ ! -e ${parameter} ]; then
|
2006-01-21 14:31:45 +00:00
|
|
|
ln -fs ${device} ${parameter}
|
|
|
|
fi
|
|
|
|
done
|
2003-05-06 01:10:33 +00:00
|
|
|
;;
|
2006-01-21 14:31:45 +00:00
|
|
|
o*) for device in ${devicelist}; do
|
|
|
|
if [ -c ${device} ]; then
|
|
|
|
chown ${parameter} ${device}
|
|
|
|
fi
|
|
|
|
done
|
2003-05-06 01:10:33 +00:00
|
|
|
;;
|
2006-01-21 14:31:45 +00:00
|
|
|
p*) for device in ${devicelist}; do
|
|
|
|
if [ -c ${device} ]; then
|
|
|
|
chmod ${parameter} ${device}
|
|
|
|
fi
|
|
|
|
done
|
2003-05-06 01:10:33 +00:00
|
|
|
;;
|
|
|
|
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"
|