diff options
Diffstat (limited to 'dahdi.init')
-rwxr-xr-x | dahdi.init | 65 |
1 files changed, 50 insertions, 15 deletions
@@ -86,11 +86,40 @@ unload_module() { rmmod $module } +# 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 + return 0 +} + +# In (xpp) hotplug mode: quit after we loaded modules. +# +# 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" = '' ] + then + exit 0 + fi +} + # Initialize the Xorcom Astribank (xpp/) using perl utiliites: xpp_startup() { # do nothing if there are no astribank devices: if ! /usr/share/dahdi/waitfor_xpds; then return 0; fi + hotplug_exit_after_load + # overriding locales for the above two, as perl can be noisy # when locales are missing. # No register all the devices if they didn't auto-register: @@ -144,21 +173,7 @@ shutdown_dynamic() { $DAHDI_CFG_CMD -s } -if [ ! -x "$DAHDI_CFG" ]; then - echo "dahdi_cfg not executable" - exit 0 -fi - -if [ ! -f /etc/dahdi/system.conf ]; then - echo "/etc/dahdi/system.conf not found. Nothing to do." - exit 0 -fi - -RETVAL=0 - -# See how we were called. -case "$1" in - start) +load_modules() { # Some systems, e.g. Debian Lenny, add here -b, which will break # loading of modules blacklisted in modprobe.d/* unset MODPROBE_OPTIONS @@ -181,6 +196,26 @@ case "$1" in fi done echo "" +} + +if [ ! -x "$DAHDI_CFG" ]; then + echo "dahdi_cfg not executable" + exit 0 +fi + +if [ ! -f /etc/dahdi/system.conf ]; then + echo "/etc/dahdi/system.conf not found. Nothing to do." + exit 0 +fi + +RETVAL=0 + +# See how we were called. +case "$1" in + start) + if hotplug_should_load_modules; then + load_modules + fi TMOUT=$DAHDI_DEV_TIMEOUT # max secs to wait |