summaryrefslogtreecommitdiff
path: root/etc/rc.subr
diff options
context:
space:
mode:
authorYaroslav Tykhiy <ytykhiy@gmail.com>2006-07-25 17:10:35 +0000
committerYaroslav Tykhiy <ytykhiy@gmail.com>2006-07-25 17:10:35 +0000
commite59cb1e6d418b09d54ac4cab7ee23942ddace1e1 (patch)
tree9b6e8c0d48ffe6629ffeabb44beb5276f59fc504 /etc/rc.subr
parente975f09f36c279a8d1ba7dd3fa5afe5d40aaf561 (diff)
downloadsrc-test2-e59cb1e6d418b09d54ac4cab7ee23942ddace1e1.tar.gz
src-test2-e59cb1e6d418b09d54ac4cab7ee23942ddace1e1.zip
Notes
Diffstat (limited to 'etc/rc.subr')
-rw-r--r--etc/rc.subr16
1 files changed, 12 insertions, 4 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index 2928d3bb47db..52acd32d37c6 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -1358,12 +1358,12 @@ mount_md()
# Code common to scripts that need to load a kernel module
# if it isn't in the kernel yet. Syntax:
-# load_kld [-e regexp] [-m modname] filename
+# load_kld [-e regex] [-m module] file
# where -e or -m chooses the way to check if the module
# is already loaded:
-# regexp is egrep'd in the output from `kldstat -v',
-# modname is passed to `kldstat -m'.
-# The default way is as though `-m filename' were specified.
+# regex is egrep'd in the output from `kldstat -v',
+# module is passed to `kldstat -m'.
+# The default way is as though `-m file' were specified.
load_kld()
{
local _loaded _mod _opt _re
@@ -1372,9 +1372,13 @@ load_kld()
case "$_opt" in
e) _re="$OPTARG" ;;
m) _mod="$OPTARG" ;;
+ *) err 3 'USAGE: load_kld [-e regex] [-m module] file' ;;
esac
done
shift $(($OPTIND - 1))
+ if [ $# -ne 1 ]; then
+ err 3 'USAGE: load_kld [-e regex] [-m module] file'
+ fi
_mod=${_mod:-$1}
_loaded=false
if [ -n "$_re" ]; then
@@ -1390,7 +1394,11 @@ load_kld()
if ! kldload "$1"; then
warn "Unable to load kernel module $1"
return 1
+ else
+ info "$1 kernel module loaded."
fi
+ else
+ debug "load_kld: $1 kernel module already loaded."
fi
return 0
}