summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-02-07 09:13:50 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-02-07 09:13:50 +0000
commit783ff76b2694fb8fd01863963ebdfc0e6403f993 (patch)
tree36121d6c552e5049a8203bbde3907066b9c59a63
parentbb8c9705e15f7307b35ec237c6da2255822620e3 (diff)
dahdi.init: allow specifying the module(s) to download.
At the 'stop' command, the dahdi init.d service unloads dahdi (and any module it depends in). With this change, the user will be able to specify the modules to unload, by setting DAHDI_UNLOAD_MODULES in init.conf. This allows: * Disabling module unloading altogether * Allowing the user to unload other modules as well, e.g. the 'echo' module of OSLEC, if you build it as part of DAHDI. Note that unless you explicitly set DAHDI_UNLOAD_MODULES, the script behaves exatly as before. git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7997 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rwxr-xr-xdahdi.init14
-rw-r--r--init.conf.sample5
2 files changed, 17 insertions, 2 deletions
diff --git a/dahdi.init b/dahdi.init
index cbc9dc7..91ae44e 100755
--- a/dahdi.init
+++ b/dahdi.init
@@ -37,6 +37,10 @@ XPP_SYNC=auto
# device nodes after the modules have loaded and before running dahdi_cfg.
DAHDI_DEV_TIMEOUT=20
+# A list of modules to unload when stopping.
+# All of their dependencies will be unloaded as well.
+DAHDI_UNLOAD_MODULES="dahdi"
+
#
# Determine which kind of configuration we're using
#
@@ -99,6 +103,12 @@ unload_module() {
rmmod $module
}
+unload_modules() {
+ for module in $DAHDI_UNLOAD_MODULES; do
+ unload_module $module
+ done
+}
+
# In (xpp) hotplug mode, the init script is also executed from the
# hotplug hook. In that case it should not attempt to loade modules.
#
@@ -275,7 +285,7 @@ case "$1" in
# Unload drivers
#shutdown_dynamic # FIXME: needs test from someone with dynamic spans
echo -n "Unloading DAHDI hardware modules: "
- if unload_module dahdi; then
+ if unload_modules; then
echo "done"
else
echo "error"
@@ -285,7 +295,7 @@ case "$1" in
fi
;;
unload)
- unload_module dahdi
+ unload_modules
;;
restart|force-reload)
$0 stop
diff --git a/init.conf.sample b/init.conf.sample
index 9fb6393..58edec5 100644
--- a/init.conf.sample
+++ b/init.conf.sample
@@ -8,6 +8,11 @@
# device nodes after the modules have loaded and before running dahdi_cfg.
#DAHDI_DEV_TIMEOUT=40
+# A list of modules to unload when stopping.
+# All of their dependencies will be unloaded as well.
+#DAHDI_UNLOAD_MODULES="" # Disable module unloading
+#DAHDI_UNLOAD_MODULES="dahdi echo" # If you use OSLEC
+
# Override settings for xpp_fxloader
#XPP_FIRMWARE_DIR=/usr/share/dahdi
#XPP_HOTPLUG_DISABLED=yes