Don't fail init script if no modules

No point in loading the modules if nobody built them yet. It is a common
case for one to install the userspace tools package but not (yet?) build
the modules. See, e.g.  http://bugs.debian.org/706046 .

With this changeset, we exit gracefully in such a case.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
Tzafrir Cohen 2013-05-23 19:49:57 +03:00 committed by Russ Meyerriecks
parent 1f26e30907
commit de23ca9c1a
1 changed files with 9 additions and 0 deletions

View File

@ -227,6 +227,11 @@ load_modules() {
echo ""
}
# Make sure that either dahdi is loaded or modprobe-able
dahdi_modules_loadable() {
modinfo dahdi >/dev/null 2>&1 || lsmod | grep -q -w ^dahdi
}
if [ ! -x "$DAHDI_CFG" ]; then
echo "dahdi_cfg not executable"
exit 0
@ -242,6 +247,10 @@ RETVAL=0
# See how we were called.
case "$1" in
start)
if ! dahdi_modules_loadable; then
echo "No DAHDI modules on the system. Not starting"
exit 0
fi
if hotplug_should_load_modules; then
load_modules
fi