Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/etc Enhance "rc.lkm" so that it works properly with "/etc/rc...
details: https://anonhg.NetBSD.org/src/rev/48f2eaec4688
branches: trunk
changeset: 486601:48f2eaec4688
user: tron <tron%NetBSD.org@localhost>
date: Fri May 26 17:46:16 2000 +0000
description:
Enhance "rc.lkm" so that it works properly with "/etc/rc.d/lkm[123]".
diffstat:
etc/rc.lkm | 181 ++++++++++++++++++++++++++++++++++--------------------------
1 files changed, 102 insertions(+), 79 deletions(-)
diffs (189 lines):
diff -r 779750cec0c1 -r 48f2eaec4688 etc/rc.lkm
--- a/etc/rc.lkm Fri May 26 17:08:21 2000 +0000
+++ b/etc/rc.lkm Fri May 26 17:46:16 2000 +0000
@@ -1,83 +1,106 @@
-# $NetBSD: rc.lkm,v 1.4 1998/12/29 16:29:23 tron Exp $
+# $NetBSD: rc.lkm,v 1.5 2000/05/26 17:46:16 tron Exp $
#
-# this script loads any LKM's that are required.
-
-[ -s /etc/lkm.conf ] && (
- while read path options entry postinstall output when; do
- cmd='modload '
-
- case $path in
- \#*|"")
- continue
- ;;
- /*)
- ;;
- *)
- if [ -f "/lkm/$path" ]; then
- path="/lkm/$path"
- elif [ -f "/usr/lkm/$path" ]; then
- path="/usr/lkm/$path"
- else
- echo "couldn't find module $path"
- fi
- ;;
- esac
-
- case $options in
- -)
- ;;
- *)
- cmd="$cmd $options"
- ;;
- esac
-
- case $entry in
- -)
- ;;
- *)
- cmd="$cmd -e $entry"
- ;;
- esac
+# this script loads or unloads LKMs (loadable kernel modules).
- case $postinstall in
- -)
- ;;
- *)
- cmd="$cmd -p $postinstall"
- ;;
- esac
-
- case $output in
- -)
- ;;
- *)
- if [ "$output" = TEMP ]; then
- cmd="$cmd -o /tmp/lkm.$$"
- else
- cmd="$cmd -o $output"
+if [ -s /etc/lkm.conf ]; then
+ case "$1" in
+ start)
+ (while read path options entry postinstall output when; do
+ cmd='modload '
+
+ case $path in
+ \#*|"")
+ continue
+ ;;
+ /*)
+ ;;
+ *)
+ if [ -f "/lkm/$path" ]; then
+ path="/lkm/$path"
+ elif [ -f "/usr/lkm/$path" ]; then
+ path="/usr/lkm/$path"
+ else
+ echo "couldn't find module $path"
+ fi
+ ;;
+ esac
+
+ case $options in
+ -)
+ ;;
+ *)
+ cmd="$cmd $options"
+ ;;
+ esac
+
+ case $entry in
+ -)
+ ;;
+ *)
+ cmd="$cmd -e $entry"
+ ;;
+ esac
+
+ case $postinstall in
+ -)
+ ;;
+ *)
+ cmd="$cmd -p $postinstall"
+ ;;
+ esac
+
+ case $output in
+ -)
+ ;;
+ *)
+ if [ "$output" = TEMP ]; then
+ cmd="$cmd -o /tmp/lkm.$$"
+ else
+ cmd="$cmd -o $output"
+ fi
+ ;;
+ esac
+
+ case $when in
+ -)
+ when=BEFORENET
+ ;;
+ [A-Z]*)
+ ;;
+ *)
+ echo "invalid \"when\" field in /etc/lkm.conf - $path not loaded!"
+ continue
+ ;;
+ esac
+
+ if [ $when != $lkmstage ]; then
+ continue
fi
- ;;
- esac
+
+ echo -n "`basename $path .o`: "
+ $cmd $path
+ rm -f /tmp/lkm.$$
+ done) < /etc/lkm.conf
+ ;;
+ stop)
+ (while read path options entry postinstall output when; do
+ case $path in
+ \#*|"")
+ continue
+ ;;
+ /*)
+ name=${path##*/}
+ name=${name%.o}
+ ;;
+ *)
+ name=${path%.o}
+ ;;
+ esac
- case $when in
- -)
- when=BEFORENET
- ;;
- [A-Z]*)
- ;;
- *)
- echo "invalid \"when\" field in /etc/lkm.conf - $path not loaded!"
- continue
- ;;
- esac
-
- if [ $when != $lkmstage ]; then
- continue
- fi
-
- echo -n "`basename $path .o`: "
- $cmd $path
- rm -f /tmp/lkm.$$
- done
-
-) < /etc/lkm.conf
+ if [ $when = $lkmstage ]; then
+ modunload -n ${name}
+ fi
+ done) < /etc/lkm.conf
+ ;;
+ esac
+fi
Home |
Main Index |
Thread Index |
Old Index