devfs support of wildcarding

From: Sean McNeil <sean_at_mcneil.com>
Date: Thu, 08 Jan 2004 13:40:59 -0800
My recent post with a change to /etc/rc.d/devfs allowed for things like:

perm	pass*	0666

to be in /etc/devfs.conf

I've made a slight modification to that to allow something like:

perm	xpt0,pass*,cd*	0666

I hope someone else might find this useful.

/etc/rc.d/devfs:
#!/bin/sh
#
# $FreeBSD: src/etc/rc.d/devfs,v 1.6 2003/08/20 06:15:18 mtm Exp $
#

# PROVIDE: devfs
# REQUIRE: LOGIN
# BEFORE:  securelevel
# KEYWORD: FreeBSD

. /etc/rc.subr

name="devfs"
start_cmd='devfs_start'
stop_cmd=':'

devfs_start()
{
	if [ -n "$devfs_system_ruleset" ]; then
		devfs_init_rulesets
		devfs_set_ruleset $devfs_system_ruleset /dev
		devfs_apply_ruleset $devfs_system_ruleset /dev
	fi
	read_devfs_conf
}

read_devfs_conf()
{
	if [ -r /etc/devfs.conf ]; then
		cd /dev
		while read action devlist parameter; do
		   for device in `echo ${devlist} | sed -e 's/,/ /g'`; 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
		done < /etc/devfs.conf
	fi
}

load_rc_config $name
run_rc_command "$1"
Received on Thu Jan 08 2004 - 12:41:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:37 UTC