Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d Parse config file like ifconfig.if(5).



details:   https://anonhg.NetBSD.org/src/rev/63cf49418dc7
branches:  trunk
changeset: 807350:63cf49418dc7
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Apr 06 15:07:50 2015 +0000

description:
Parse config file like ifconfig.if(5).
First word is always the module name, followed by options.
Load modules right after root filesystem is checked and before it
becomes writable.

diffstat:

 etc/rc.d/modules |  24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r 699acba9a57e -r 63cf49418dc7 etc/rc.d/modules
--- a/etc/rc.d/modules  Mon Apr 06 14:38:22 2015 +0000
+++ b/etc/rc.d/modules  Mon Apr 06 15:07:50 2015 +0000
@@ -1,10 +1,11 @@
 #!/bin/sh
 #
-# $NetBSD: modules,v 1.1 2015/03/21 19:10:43 jmcneill Exp $
+# $NetBSD: modules,v 1.2 2015/04/06 15:07:50 mlelstv Exp $
 #
 
 # PROVIDE: modules
-# BEFORE:  securelevel
+# REQUIRE: fsck_root
+# BEFORE: root
 
 $_rc_subr_loaded . /etc/rc.subr
 
@@ -17,12 +18,19 @@
 {
        if [ -f /etc/modules.conf ]; then
                echo "Loading modules."
-               cat /etc/modules.conf |
-               while read -r args; do
-                       args=${args%%#*}                # strip comments
-                       test -z "$args" && continue
-                       /sbin/modload $args
-               done
+               while read name args; do
+                       case $name in
+                       ''|"#"*)
+                               ;;
+                       *)
+                               (
+                                       set -o noglob
+                                       eval set -- $args
+                                       modload "$@" "$name"
+                               )
+                               ;;
+                       esac
+               done < /etc/modules.conf
        fi
 }
 



Home | Main Index | Thread Index | Old Index