~ubuntu-branches/ubuntu/saucy/dahdi-tools/saucy

« back to all changes in this revision

Viewing changes to debian/patches/init_unload_modules

  • Committer: Bazaar Package Importer
  • Author(s): Jean-Michel Dault, Tzafrir Cohen
  • Date: 2010-02-16 13:44:09 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100216134409-4y4k26mgzyra537o
Tags: 1:2.2.1-0ubuntu1
* Merge from Debian pkg-voip.
  * Changes from Debian:
  - debian/control: Change Maintainer
  - debian/control: Removed Uploaders field.
  - debian/control: Removed Debian Vcs-Svn entry and replaced with
      ubuntu-voip Vcs-Bzr, to reflect divergence in packages.
  - debian/control: Package dahdi Depends on  dahdi-dkms | dahdi-source

* From Debian pkg-voip:
[ Tzafrir Cohen ]
* New upstream release (Closes: #536257, #564381).
* Patch 'bashism' dropped: merged upstream. 
* Patch xpp_no_extra_at dropped: merged upstream. 
* Add an example genconf_parameters.
* Compat level 7.
* Bump standars version to 3.8.3.0 (no change needed)
* Udev rules are now in dahdi-linux.
* Patches perl_fix_noserial, perl_fix_transportdir: Fixes for some
  minor perl issues.
* Add the missing ${misc:Depends}, as per lintian. 
* Patch astribank_allow_ignoreend: an extra missing patch from upstream. 
* Patches init_unload_modules and init_unload_oslec: also unload OSLEC
  when unloading all modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
 
2
Date: Sun, 7 Feb 2010 09:13:50 +0000
 
3
Subject: dahdi.init: allow specifying the module(s) to download.
 
4
Origin: http://svn.digium.com/svn/dahdi/tools/trunk@7997
 
5
 
 
6
At the 'stop' command, the dahdi init.d service unloads dahdi
 
7
(and any module it depends in).
 
8
 
 
9
With this change, the user will be able to specify the modules to
 
10
unload, by setting DAHDI_UNLOAD_MODULES in init.conf. This allows:
 
11
 
 
12
* Disabling module unloading altogether
 
13
* Allowing the user to unload other modules as well, e.g. the 'echo'
 
14
  module of OSLEC, if you build it as part of DAHDI.
 
15
 
 
16
Note that unless you explicitly set DAHDI_UNLOAD_MODULES, the script
 
17
behaves exatly as before.
 
18
 
 
19
This patch is included in current trunk of dahdi-tools (will become 2.3).
 
20
 
 
21
---
 
22
 dahdi.init       |   14 ++++++++++++--
 
23
 init.conf.sample |    5 +++++
 
24
 2 files changed, 17 insertions(+), 2 deletions(-)
 
25
 
 
26
diff --git a/dahdi.init b/dahdi.init
 
27
index cbc9dc7..91ae44e 100755
 
28
--- a/dahdi.init
 
29
+++ b/dahdi.init
 
30
@@ -37,6 +37,10 @@ XPP_SYNC=auto
 
31
 # device nodes after the modules have loaded and before running dahdi_cfg.
 
32
 DAHDI_DEV_TIMEOUT=20
 
33
 
 
34
+# A list of modules to unload when stopping.
 
35
+# All of their dependencies will be unloaded as well.
 
36
+DAHDI_UNLOAD_MODULES="dahdi"
 
37
+
 
38
 #
 
39
 # Determine which kind of configuration we're using
 
40
 #
 
41
@@ -99,6 +103,12 @@ unload_module() {
 
42
        rmmod $module
 
43
 }
 
44
 
 
45
+unload_modules() {
 
46
+       for module in $DAHDI_UNLOAD_MODULES; do
 
47
+               unload_module $module
 
48
+       done
 
49
+}
 
50
+
 
51
 # In (xpp) hotplug mode, the init script is also executed from the
 
52
 # hotplug hook. In that case it should not attempt to loade modules.
 
53
 #
 
54
@@ -275,7 +285,7 @@ case "$1" in
 
55
        # Unload drivers
 
56
        #shutdown_dynamic # FIXME: needs test from someone with dynamic spans
 
57
        echo -n "Unloading DAHDI hardware modules: "
 
58
-       if unload_module dahdi; then
 
59
+       if unload_modules; then
 
60
                echo "done"
 
61
        else
 
62
                echo "error"
 
63
@@ -285,7 +295,7 @@ case "$1" in
 
64
        fi
 
65
        ;;
 
66
   unload)
 
67
-       unload_module dahdi
 
68
+       unload_modules
 
69
        ;;
 
70
   restart|force-reload)
 
71
        $0 stop
 
72
diff --git a/init.conf.sample b/init.conf.sample
 
73
index 9fb6393..58edec5 100644
 
74
--- a/init.conf.sample
 
75
+++ b/init.conf.sample
 
76
@@ -8,6 +8,11 @@
 
77
 # device nodes after the modules have loaded and before running dahdi_cfg. 
 
78
 #DAHDI_DEV_TIMEOUT=40
 
79
 
 
80
+# A list of modules to unload when stopping.
 
81
+# All of their dependencies will be unloaded as well.
 
82
+#DAHDI_UNLOAD_MODULES=""               # Disable module unloading
 
83
+#DAHDI_UNLOAD_MODULES="dahdi echo"     # If you use OSLEC
 
84
+
 
85
 # Override settings for xpp_fxloader
 
86
 #XPP_FIRMWARE_DIR=/usr/share/dahdi
 
87
 #XPP_HOTPLUG_DISABLED=yes
 
88
-- 
 
89
1.6.5
 
90