summaryrefslogtreecommitdiff
path: root/dahdi.init
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-10-21 14:30:32 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-10-21 14:30:32 +0000
commit939ffb7577ce08dfc552ce0c112e9d51fd2b4519 (patch)
treeb109d414522a83530be7999b0aa9d13a61f5c739 /dahdi.init
parentee453cb6ce6863f1b3f87888bf4572d1f6455cb3 (diff)
Fix XPP_HOTPLUG_DAHDI: logic; end of init.d script
'Hotplug mode' was introduced in r7335. * The logic in the script was broken. - Negative logic is not such a grand idea to start with. * Interactive invocation of init.d ends when expected and not sooner. This change makes waitfor_xpds wait longer. Rather than waiting for all the Astribanks to load, it will now wait until the initialization of dahdi from the Astribanks hook script is run. This allows running e.g.: /etc/init.d/dahdi start; /etc/init.d/asterisk start It also means that 'astribank_is_starting' is actually used as a semaphore and not only as stamp file. As before, those changes have no effect if hotplug mode is not explicitly enabled (setting 'XPP_HOTPLUG_DAHDI=yes' in init.conf). git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7409 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'dahdi.init')
-rwxr-xr-xdahdi.init24
1 files changed, 15 insertions, 9 deletions
diff --git a/dahdi.init b/dahdi.init
index a5ed780..5730c3b 100755
--- a/dahdi.init
+++ b/dahdi.init
@@ -86,10 +86,13 @@ unload_module() {
rmmod $module
}
-# In (xpp) hotplug mode, if we're called from udev, skip loading
-# modules:
-hotplug_skip_modprobe() {
- if [ "$XPP_HOTPLUG_DAHDI" = yes -a "$CALLED_FROM_ATRIBANK_HOOK" = '' ]
+# In (xpp) hotplug mode, the init script is also executed from the
+# hotplug hook. In that case it should not attempt to loade modules.
+#
+# This function only retunrs false (1) if we're in hotplug mode and
+# coming from the hotplug hook script.
+hotplug_should_load_modules() {
+ if [ "$XPP_HOTPLUG_DAHDI" = yes -a "$CALLED_FROM_ATRIBANK_HOOK" != '' ]
then
return 1
fi
@@ -97,11 +100,14 @@ hotplug_skip_modprobe() {
}
# In (xpp) hotplug mode: quit after we loaded modules.
-# Make sure that this is only called if there is an Astribank on the
-# system, which will call the rest of the script from the
-# astribank_hook.
+#
+# In hotplug mode, the main run should end here, whereas the rest of the
+# script should be finished by the instance running from the hook.
+# Note that we only get here if there are actually Astribanks on the
+# system (otherwise noone will trigger the run of the hotplug hook
+# script).
hotplug_exit_after_load() {
- if [ "$XPP_HOTPLUG_DAHDI" = yes -a "$CALLED_FROM_ATRIBANK_HOOK" != '' ]
+ if [ "$XPP_HOTPLUG_DAHDI" = yes -a "$CALLED_FROM_ATRIBANK_HOOK" = '' ]
then
exit 0
fi
@@ -207,7 +213,7 @@ RETVAL=0
# See how we were called.
case "$1" in
start)
- if ! hotplug_skip_modprobe; then
+ if hotplug_should_load_modules; then
load_modules
fi