/etc/rc.d/devfs modification to allow wildcard device names in /etc/devfs.conf

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

/etc/rc.d/devfs modification to allow wildcard device names in /etc/devfs.conf

Darren Pilgrim-2
I recently needed to change the default permissions of some of the "dial
out" serial devices on a system for use with NUT (sysutils/nut port).  For
the sake of efficiency, I wanted to use a wildcard expression only to find
out that /etc/rc.d/devfs doesn't grok sh-style filename globbing.  So I
modified the script.  I wrapped each sub-procedure in the case structure
with a for...done that expands the device string into a list for iteration.
The result is that I can put lines like the following in /etc/devfs.conf:

own cuad[1,2]* nut:nut
perm cuad[1,2]* 0660

The non-wildcard equivalent would be:

own cuad1 nut:nut
own cuad1.init nut:nut
own cuad1.lock nut:nut
own cuad2 nut:nut
own cuad2.init nut:nut
own cuad2.lock nut:nut
perm cuad1 0660
perm cuad1.init 0660
perm cuad1.lock 0660
perm cuad2 0660
perm cuad2.init 0660
perm cuad2.lock 0660

I wrote two versions of the modification, one takes the device expression
literally (the _literal.patch file), the other explicitly expands it with ls
(the _backticked_ls.patch file).  Both appear to work fine, but IMO the
latter seems a safer approach.  The modifications and testing were done on a
current RELENG_6_0 box where /etc/rc.d/devfs is v1.10.  The v1.11 in -HEAD
is effectively identical, so it should apply cleanly to that version as
well.

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-rc
To unsubscribe, send any mail to "[hidden email]"

etc_rc.d_devfs_literal.patch (1K) Download Attachment
etc_rc.d_devfs_backticked_ls.patch (1K) Download Attachment