NetBSD/etc/rc.lkm
1998-12-29 16:29:23 +00:00

84 lines
1.1 KiB
Plaintext

# $NetBSD: rc.lkm,v 1.4 1998/12/29 16:29:23 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
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
echo -n "`basename $path .o`: "
$cmd $path
rm -f /tmp/lkm.$$
done
) < /etc/lkm.conf