DEVFS - Add rc.d script to load rules at startup
authorMatthias Schmidt <matthias@dragonflybsd.org>
Tue, 25 Aug 2009 15:53:09 +0000 (17:53 +0200)
committerMatthias Schmidt <matthias@dragonflybsd.org>
Tue, 25 Aug 2009 15:53:09 +0000 (17:53 +0200)
The script will load default rules from /etc/defaults/devfs.conf and
user supplied rules from /etc/devfs.conf

etc/defaults/devfs.conf [new file with mode: 0644]
etc/defaults/rc.conf
etc/rc.d/devfs [new file with mode: 0644]
sbin/devfsctl/devfsctl.8

diff --git a/etc/defaults/devfs.conf b/etc/defaults/devfs.conf
new file mode 100644 (file)
index 0000000..749e388
--- /dev/null
@@ -0,0 +1,5 @@
+# Default rules for devfs(5)
+# Add your own rules to /etc/devfs.conf
+
+link   dsp0    dsp
+link   mixer0  mixer
index 9bfb94f..10fc897 100644 (file)
@@ -42,6 +42,8 @@ fsck_y_enable="NO"    # Set to YES to do fsck -y if the initial preen fails.
 netfs_types="nfs:NFS smbfs:SMB portalfs:PORTAL nwfs:NWFS" # Net filesystems.
 extra_netfs_types="NO" # List of network extra filesystem types for delayed
                        # mount at startup (or NO).
+devfs_config_files="/etc/defaults/devfs.conf /etc/devfs.conf"
+                       # Config files for devfs(5)
 
 ##############################################################
 ###  Network configuration sub-section  ######################
diff --git a/etc/rc.d/devfs b/etc/rc.d/devfs
new file mode 100644 (file)
index 0000000..7af7611
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+
+# PROVIDE: devfs
+# REQUIRE: rcconf
+# BEFORE: disks
+
+. /etc/rc.subr
+
+name="devfs"
+load_rc_config $name
+start_cmd="load_rules"
+stop_cmd=":"
+
+load_rules()
+{
+       echo "Loading devfs rules"
+       set -- $devfs_config_files
+       for file; do
+               /sbin/devfsctl -a -f $file
+       done
+
+}
+
+load_rc_config $name
+run_rc_command "$1"
index 3815da4..afc8bda 100644 (file)
@@ -29,7 +29,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 13, 2009
+.Dd August 25, 2009
 .Os
 .Dt DEVFSCTL 8
 .Sh NAME
@@ -205,8 +205,10 @@ This will show previously hidden nodes again.
 .El
 .Sh FILES
 .Bl -tag -width ".Pa /etc/devfs" -compact
-.It Pa /etc/devfs/*
-devfs ruleset files
+.It Pa /etc/defaults/devfs.conf
+Global devfs ruleset file
+.It Pa /etc/devfs.conf
+Local devfs ruleset file
 .El
 .Sh EXAMPLES
 Examples of valid names: