2005-03-05 00:11:23 +03:00
|
|
|
# $NetBSD: rc.lkm,v 1.9 2005/03/04 21:11:23 cube Exp $
|
1997-01-05 14:47:53 +03:00
|
|
|
#
|
2000-05-26 21:46:16 +04:00
|
|
|
# this script loads or unloads LKMs (loadable kernel modules).
|
1997-01-05 14:47:53 +03:00
|
|
|
|
2000-05-26 21:46:16 +04:00
|
|
|
if [ -s /etc/lkm.conf ]; then
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
(while read path options entry postinstall output when; do
|
2000-09-10 20:50:05 +04:00
|
|
|
flags=''
|
2000-05-26 21:46:16 +04:00
|
|
|
|
|
|
|
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
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
2000-09-10 20:50:05 +04:00
|
|
|
flags="$flags $options"
|
2000-05-26 21:46:16 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $entry in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
2000-09-10 20:50:05 +04:00
|
|
|
flags="$flags -e $entry"
|
2000-05-26 21:46:16 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $postinstall in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
2000-09-10 20:50:05 +04:00
|
|
|
flags="$flags -p $postinstall"
|
2000-05-26 21:46:16 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $output in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ "$output" = TEMP ]; then
|
2000-09-10 20:50:05 +04:00
|
|
|
flags="$flags -o /tmp/lkm.$$"
|
2000-05-26 21:46:16 +04:00
|
|
|
else
|
2000-09-10 20:50:05 +04:00
|
|
|
flags="$flags -o $output"
|
2000-05-26 21:46:16 +04:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $when in
|
|
|
|
-)
|
|
|
|
when=BEFORENET
|
|
|
|
;;
|
|
|
|
[A-Z]*)
|
|
|
|
;;
|
|
|
|
*)
|
2003-01-06 01:47:12 +03:00
|
|
|
echo "invalid \"when\" field \`${when}' in /etc/lkm.conf - $path not loaded!"
|
2000-05-26 21:46:16 +04:00
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2000-09-10 20:50:05 +04:00
|
|
|
if [ "$when" != "$lkmstage" ]; then
|
2000-05-26 21:46:16 +04:00
|
|
|
continue
|
1997-01-05 14:47:53 +03:00
|
|
|
fi
|
2000-05-26 21:46:16 +04:00
|
|
|
|
2000-10-07 11:36:56 +04:00
|
|
|
echo -n "${path##*/}: "
|
2000-09-10 20:50:05 +04:00
|
|
|
modload $flags $path
|
2000-05-26 21:46:16 +04:00
|
|
|
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
|
1997-01-05 14:47:53 +03:00
|
|
|
|
2000-09-10 20:50:05 +04:00
|
|
|
if [ "$when" = "$lkmstage" ]; then
|
2000-05-26 21:46:16 +04:00
|
|
|
modunload -n ${name}
|
1998-12-29 19:29:23 +03:00
|
|
|
fi
|
2000-05-26 21:46:16 +04:00
|
|
|
done) < /etc/lkm.conf
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|