From de23ca9c1a6055f187b16f059661691109a382c0 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Thu, 23 May 2013 19:49:57 +0300 Subject: [PATCH] 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 Signed-off-by: Russ Meyerriecks --- dahdi.init | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dahdi.init b/dahdi.init index 5fe3cec..c772a92 100755 --- a/dahdi.init +++ b/dahdi.init @@ -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