[svn-commits] tzafrir: branch tzafrir/zaphelper r1634 - in /team/tzafrir/zaphelper: ./ exam...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Nov 21 23:10:17 MST 2006


Author: tzafrir
Date: Wed Nov 22 00:10:17 2006
New Revision: 1634

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1634
Log:
Start splitting zaptel.init into distro-specific scripts.
 * examples/zaptel.debian.init is basically ready.
 * examples/zaptel.{rh,suse}.init are copies of an older zaptel.init so far.
 * new zaptel-helper functions:
 - init_astribank to run all of the Astribank functions.
 - fxotune_load to load fxotune.
 * Fixed a typo with the default value of fxotune.

Added:
    team/tzafrir/zaphelper/examples/
    team/tzafrir/zaphelper/examples/zaptel.debian.init   (with props)
    team/tzafrir/zaphelper/examples/zaptel.rh.init   (with props)
    team/tzafrir/zaphelper/examples/zaptel.suse.init   (with props)
Modified:
    team/tzafrir/zaphelper/zaptel-helper
    team/tzafrir/zaphelper/zaptel.init

Added: team/tzafrir/zaphelper/examples/zaptel.debian.init
URL: http://svn.digium.com/view/zaptel/team/tzafrir/zaphelper/examples/zaptel.debian.init?view=auto&rev=1634
==============================================================================
--- team/tzafrir/zaphelper/examples/zaptel.debian.init (added)
+++ team/tzafrir/zaphelper/examples/zaptel.debian.init Wed Nov 22 00:10:17 2006
@@ -1,0 +1,77 @@
+#!/bin/sh
+#
+# FIXME: make lsb-compliant.
+# zaptel        This shell script takes care of loading and unloading \
+#               Zapata Telephony interfaces
+# chkconfig: 2345 9 92
+# description: The zapata telephony drivers allow you to use your linux \
+# computer to accept incoming data and voice interfaces
+#
+# config: /etc/sysconfig/zaptel
+
+set -e
+
+# include it. Don't run it:
+ZAPHELPER_ONLY_INCLUDE=1
+
+ZAPHELPER_PATH=/sbin/zaptel-helper
+
+ZTCFG=/sbin/ztcfg
+ZAPCONF_FILE=/etc/zaptel.conf
+
+DESC="Zaptel telephony kernel driver"
+
+if [ -r /etc/default/zaptel ]; then . /etc/default/zaptel; fi
+
+if [ -r "$ZAPHELPER_PATH" ]; then . $ZAPHELPER_PATH; fi
+
+if [ ! -x $ZTCFG ] ; then
+	echo >&2 $NAME ":" $ZTCFG "fails test for exists and executable" ;
+	exit 0
+fi
+
+if [ ! -r $ZAPCONF_FILE ] ; then
+	echo >&2 $NAME ":" $ZAPCONF_FILE "fails test for exists and readable";
+	exit 0
+fi
+
+# See how we were called.
+case "$1" in
+start)
+	echo -n "$DESC:"
+
+	# Assumes that the modules were already modprobed
+
+	# Get the Astribank module loaded properly:
+	init_astribank
+
+	# wait for udev to generate /dev/zap/ctl before running ztcfg
+	wait_for_zapctl
+
+	# load ztdummy if there is no existing timing source.
+	# FIXME: we check that /dev/zap/ctl was generated, not that 
+	# /dev/zap/pseudo was generated.
+	guarantee_timing_source
+
+	fxotune_load
+
+	$ZTCFG || echo -n "$ZTCFG failed. Check $ZAPCONF_FILE"
+	echo "$NAME."
+	;;
+stop)
+	# FIXME: What should be done here?
+	;;
+restart)
+	$0 stop
+	$0 start
+	;;
+reload)
+	echo -n "Reloading ztcfg: "
+	$ZTCFG && echo -n "done"
+	echo "."
+	;;
+*)
+	echo "Usage: zaptel {start|stop|restart|reload}"
+	exit 1
+esac
+

Propchange: team/tzafrir/zaphelper/examples/zaptel.debian.init
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/tzafrir/zaphelper/examples/zaptel.debian.init
------------------------------------------------------------------------------
    svn:executable = *

Propchange: team/tzafrir/zaphelper/examples/zaptel.debian.init
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/tzafrir/zaphelper/examples/zaptel.debian.init
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/tzafrir/zaphelper/examples/zaptel.rh.init
URL: http://svn.digium.com/view/zaptel/team/tzafrir/zaphelper/examples/zaptel.rh.init?view=auto&rev=1634
==============================================================================
--- team/tzafrir/zaphelper/examples/zaptel.rh.init (added)
+++ team/tzafrir/zaphelper/examples/zaptel.rh.init Wed Nov 22 00:10:17 2006
@@ -1,0 +1,120 @@
+#!/bin/sh
+#
+# FIXME: make lsb-compliant.
+# zaptel        This shell script takes care of loading and unloading \
+#               Zapata Telephony interfaces
+# chkconfig: 2345 9 92
+# description: The zapata telephony drivers allow you to use your linux \
+# computer to accept incoming data and voice interfaces
+#
+# config: /etc/sysconfig/zaptel
+
+initdir=/etc/init.d
+
+# include it. Don't run it:
+ZAPHELPER_ONLY_INCLUDE=1
+
+ZAPHELPER_PATH=/sbin/zaptel-helper
+
+ZTCFG=/sbin/ztcfg
+
+#
+# Determine which kind of configuration we're using
+#
+system=redhat  # assume redhat
+if [ -f /etc/debian_version ]; then
+	system=debian
+fi
+
+# Source function library.
+if [ $system = redhat ]; then
+	. $initdir/functions || exit 0
+fi
+
+# Source zaptel configuration.
+if [ $system = debian ]; then
+	set -e
+	if [ -r /etc/default/zaptel ]; then . /etc/default/zaptel; fi
+	LOCKFILE=/var/lock/zaptel # FIXME: not used with Debian.
+elif [ $system = redhat ]; then
+	[ -r /etc/sysconfig/zaptel ] && . /etc/sysconfig/zaptel
+	LOCKFILE=/var/lock/subsys/zaptel
+fi
+
+if [ -r "$ZAPHELPER_PATH" ]; then . $ZAPHELPER_PATH; fi
+
+if [ -z "${MODULES}" ]; then 
+	# Populate defaults if not present
+	MODULES="tor2 wct4xxp wct1xxp wcte11xp wcfxo wctdm wctdm24xxp" 
+fi
+
+# Check that telephony is up.
+[ "${TELEPHONY}" = "yes" ] || exit 0
+
+[ -f /sbin/ztcfg ] || exit 0
+
+[ -f /etc/zaptel.conf ] || exit 0
+
+RETVAL=0
+
+# See how we were called.
+case "$1" in
+start)
+	echo -n "Loading zaptel hardware modules:"
+	if [ "$system" = redhat ]; then
+		for mod in ${MODULES}; do
+			modprobe $mod
+		done
+	fi
+
+	# Get the Astribank module loaded properly:
+	wait_for_xpp
+	zap_reg_xpp
+	fix_asterisbank_sync
+
+	# wait for udev to generate /dev/zap/ctl before running ztcfg
+	wait_for_zapctl
+
+	# load ztdummy if there is no existing timing source.
+	# FIXME: we check that /dev/zap/ctl was generated, not that 
+	# /dev/zap/pseudo was generated.
+	guarantee_timing_source
+
+	$ZTCFG
+	
+	RETVAL=$?
+
+	[ $RETVAL -eq 0 ] && touch $LOCKFILE
+	;;
+stop)
+	# Unload drivers
+	# FIXME: Not for Debian?
+	echo -n "Unloading zaptel hardware drivers:"
+	unload_modules
+	echo .
+	
+	RETVAL=$?
+
+	[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+	;;
+restart)
+	$0 stop
+	$0 start
+	;;
+reload)
+	if [ $system = debian ]; then
+		echo -n "Reloading ztcfg: "
+		$ZTCFG && echo -n "done"
+		echo "."
+	elif [ $system = redhat ]; then
+		action "Reloading ztcfg: " $ZTCFG
+	fi
+	RETVAL=$?
+	;;
+*)
+	echo "Usage: zaptel {start|stop|restart|reload}"
+	exit 1
+esac
+
+exit $RETVAL
+

Propchange: team/tzafrir/zaphelper/examples/zaptel.rh.init
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/tzafrir/zaphelper/examples/zaptel.rh.init
------------------------------------------------------------------------------
    svn:executable = *

Propchange: team/tzafrir/zaphelper/examples/zaptel.rh.init
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/tzafrir/zaphelper/examples/zaptel.rh.init
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/tzafrir/zaphelper/examples/zaptel.suse.init
URL: http://svn.digium.com/view/zaptel/team/tzafrir/zaphelper/examples/zaptel.suse.init?view=auto&rev=1634
==============================================================================
--- team/tzafrir/zaphelper/examples/zaptel.suse.init (added)
+++ team/tzafrir/zaphelper/examples/zaptel.suse.init Wed Nov 22 00:10:17 2006
@@ -1,0 +1,120 @@
+#!/bin/sh
+#
+# FIXME: make lsb-compliant.
+# zaptel        This shell script takes care of loading and unloading \
+#               Zapata Telephony interfaces
+# chkconfig: 2345 9 92
+# description: The zapata telephony drivers allow you to use your linux \
+# computer to accept incoming data and voice interfaces
+#
+# config: /etc/sysconfig/zaptel
+
+initdir=/etc/init.d
+
+# include it. Don't run it:
+ZAPHELPER_ONLY_INCLUDE=1
+
+ZAPHELPER_PATH=/sbin/zaptel-helper
+
+ZTCFG=/sbin/ztcfg
+
+#
+# Determine which kind of configuration we're using
+#
+system=redhat  # assume redhat
+if [ -f /etc/debian_version ]; then
+	system=debian
+fi
+
+# Source function library.
+if [ $system = redhat ]; then
+	. $initdir/functions || exit 0
+fi
+
+# Source zaptel configuration.
+if [ $system = debian ]; then
+	set -e
+	if [ -r /etc/default/zaptel ]; then . /etc/default/zaptel; fi
+	LOCKFILE=/var/lock/zaptel # FIXME: not used with Debian.
+elif [ $system = redhat ]; then
+	[ -r /etc/sysconfig/zaptel ] && . /etc/sysconfig/zaptel
+	LOCKFILE=/var/lock/subsys/zaptel
+fi
+
+if [ -r "$ZAPHELPER_PATH" ]; then . $ZAPHELPER_PATH; fi
+
+if [ -z "${MODULES}" ]; then 
+	# Populate defaults if not present
+	MODULES="tor2 wct4xxp wct1xxp wcte11xp wcfxo wctdm wctdm24xxp" 
+fi
+
+# Check that telephony is up.
+[ "${TELEPHONY}" = "yes" ] || exit 0
+
+[ -f /sbin/ztcfg ] || exit 0
+
+[ -f /etc/zaptel.conf ] || exit 0
+
+RETVAL=0
+
+# See how we were called.
+case "$1" in
+start)
+	echo -n "Loading zaptel hardware modules:"
+	if [ "$system" = redhat ]; then
+		for mod in ${MODULES}; do
+			modprobe $mod
+		done
+	fi
+
+	# Get the Astribank module loaded properly:
+	wait_for_xpp
+	zap_reg_xpp
+	fix_asterisbank_sync
+
+	# wait for udev to generate /dev/zap/ctl before running ztcfg
+	wait_for_zapctl
+
+	# load ztdummy if there is no existing timing source.
+	# FIXME: we check that /dev/zap/ctl was generated, not that 
+	# /dev/zap/pseudo was generated.
+	guarantee_timing_source
+
+	$ZTCFG
+	
+	RETVAL=$?
+
+	[ $RETVAL -eq 0 ] && touch $LOCKFILE
+	;;
+stop)
+	# Unload drivers
+	# FIXME: Not for Debian?
+	echo -n "Unloading zaptel hardware drivers:"
+	unload_modules
+	echo .
+	
+	RETVAL=$?
+
+	[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+	;;
+restart)
+	$0 stop
+	$0 start
+	;;
+reload)
+	if [ $system = debian ]; then
+		echo -n "Reloading ztcfg: "
+		$ZTCFG && echo -n "done"
+		echo "."
+	elif [ $system = redhat ]; then
+		action "Reloading ztcfg: " $ZTCFG
+	fi
+	RETVAL=$?
+	;;
+*)
+	echo "Usage: zaptel {start|stop|restart|reload}"
+	exit 1
+esac
+
+exit $RETVAL
+

Propchange: team/tzafrir/zaphelper/examples/zaptel.suse.init
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/tzafrir/zaphelper/examples/zaptel.suse.init
------------------------------------------------------------------------------
    svn:executable = *

Propchange: team/tzafrir/zaphelper/examples/zaptel.suse.init
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/tzafrir/zaphelper/examples/zaptel.suse.init
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/tzafrir/zaphelper/zaptel-helper
URL: http://svn.digium.com/view/zaptel/team/tzafrir/zaphelper/zaptel-helper?view=diff&rev=1634&r1=1633&r2=1634
==============================================================================
--- team/tzafrir/zaphelper/zaptel-helper (original)
+++ team/tzafrir/zaphelper/zaptel-helper Wed Nov 22 00:10:17 2006
@@ -9,7 +9,7 @@
 # loading zaptel
 DEVZAP_TIMEOUT=${DEVZAP_TIMEOUT:-20}
 
-# Zaptel modules we'll try
+# Zaptel modules we'll try when detecting zaptel hardware:
 ALL_MODULES="${ALL_MODULES:-zaphfc qozap ztgsm wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wct1xxp wct4xxp wcte11xp wanpipe wcusb xpp_usb}"
 
 # Where do we write the list of modules we detected (if at all):
@@ -17,7 +17,8 @@
 MODLIST_FILE_REDHAT=${MODLIST_FILE_REDHAT:-/etc/sysconfig/zaptel}
 
 # The location of of the fxotune binary
-FXOTUNE=${FXOTUNE:/usr/sbin/fxotune}
+FXOTUNE="${FXOTUNE:-/usr/sbin/fxotune}"
+FXOTUNE_CONF="${FXOTUNE_CONF:-/etc/fxotune.conf}"
 
 ZTCFG="${ZTCFG:-/sbin/ztcfg}"
 
@@ -66,6 +67,15 @@
 		error "No /dev/zap/ctl: cannot run ztcfg. Aborting."
 	fi
 }
+
+# load the fxotune parameters
+# FIXME: /etc/fxotune.conf is a bad location for that file . 
+# /etc/zaptel/fxotune.conf?
+fxotune_load() {
+	if [ -x "$FXOTUNE" ] && [ -r "FXOTUNE_CONF" ]; then
+		$FROTUNE -s
+	fi
+}
 	
 # If there is no zaptel timing source, load
 # ztdummy. Other modules should have been loaded by
@@ -153,6 +163,12 @@
 	then 
 		error "Updating XPP sync source failed (used XPP_SYNC='$XPP_SYNC')"
 	fi
+}
+
+init_astribank() {
+	wait_fox_xpp
+	zap_reg_xpp
+	fix_asterisbank_sync
 }
 
 # The current Debian start function.

Modified: team/tzafrir/zaphelper/zaptel.init
URL: http://svn.digium.com/view/zaptel/team/tzafrir/zaphelper/zaptel.init?view=diff&rev=1634&r1=1633&r2=1634
==============================================================================
--- team/tzafrir/zaphelper/zaptel.init (original)
+++ team/tzafrir/zaphelper/zaptel.init Wed Nov 22 00:10:17 2006
@@ -68,9 +68,7 @@
 	fi
 
 	# Get the Astribank module loaded properly:
-	wait_for_xpp
-	zap_reg_xpp
-	fix_asterisbank_sync
+	init_astribank
 
 	# wait for udev to generate /dev/zap/ctl before running ztcfg
 	wait_for_zapctl
@@ -79,6 +77,8 @@
 	# FIXME: we check that /dev/zap/ctl was generated, not that 
 	# /dev/zap/pseudo was generated.
 	guarantee_timing_source
+
+	fxotune_load
 
 	$ZTCFG
 	



More information about the svn-commits mailing list