[zaptel-commits] tzafrir: branch tzafrir/zaphelper r1639 - /team/tzafrir/zaphelper/examples/

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed Nov 22 16:39:10 MST 2006


Author: tzafrir
Date: Wed Nov 22 17:39:09 2006
New Revision: 1639

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1639
Log:
First shot at the suse init script: 
 * Basically the RH script with minor modifications.
 * Based on http://bugs.digium.com/view.php?id=8364
 * Still needs some adaptations.

Modified:
    team/tzafrir/zaphelper/examples/zaptel.suse.init

Modified: team/tzafrir/zaphelper/examples/zaptel.suse.init
URL: http://svn.digium.com/view/zaptel/team/tzafrir/zaphelper/examples/zaptel.suse.init?view=diff&rev=1639&r1=1638&r2=1639
==============================================================================
--- team/tzafrir/zaphelper/examples/zaptel.suse.init (original)
+++ team/tzafrir/zaphelper/examples/zaptel.suse.init Wed Nov 22 17:39:09 2006
@@ -1,11 +1,19 @@
 #!/bin/sh
 #
-# FIXME: make lsb-compliant.
 # zaptel        This shell script takes care of loading and unloading \
 #               Zapata Telephony interfaces
-# chkconfig: 2345 9 92
+# chkconfig: 2345 95 10
 # description: The zapata telephony drivers allow you to use your linux \
 # computer to accept incoming data and voice interfaces
+#
+### BEGIN INIT INFO
+# Provides:          zaptel
+# Required-Start:
+# Required-Stop:
+# Default-Start:     3 5
+# Default-Stop:      0 1 2 4 6
+# Description: zaptel - zaptel modules for Asterisk
+### END INIT INFO
 #
 # config: /etc/sysconfig/zaptel
 
@@ -17,43 +25,24 @@
 ZAPHELPER_PATH=/sbin/zaptel-helper
 
 ZTCFG=/sbin/ztcfg
+ZAPCONF_FILE=/etc/zaptel.conf
 
-#
-# Determine which kind of configuration we're using
-#
-system=redhat  # assume redhat
-if [ -f /etc/debian_version ]; then
-	system=debian
-fi
+MODULES="${MODULES:-tor2 wct4xxp wct1xxp wcte11xp wcfxo wctdm wctdm24xxp}"
 
-# Source function library.
-if [ $system = redhat ]; then
-	. $initdir/functions || exit 0
-fi
+. /etc/rc.status || exit 0
+rc_reset
 
-# 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 /etc/sysconfig/zaptel ]; then . /etc/sysconfig/zaptel; fi
+LOCKFILE=/var/lock/subsys/zaptel
 
 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
+if [ ! -x $ZTCFG ]; then exit 0; fi
 
-[ -f /etc/zaptel.conf ] || exit 0
+if [ ! -r $ZAPCONF_FILE ]; then exit 0; fi
 
 RETVAL=0
 
@@ -68,9 +57,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 +66,8 @@
 	# FIXME: we check that /dev/zap/ctl was generated, not that 
 	# /dev/zap/pseudo was generated.
 	guarantee_timing_source
+
+	fxotune_load
 
 	$ZTCFG
 	
@@ -93,22 +82,14 @@
 	unload_modules
 	echo .
 	
-	RETVAL=$?
-
-	[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+	$ZTCFG || rc_failed 1 ; rc_status -v
 	;;
 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
+	action "Reloading ztcfg: " $ZTCFG
 	RETVAL=$?
 	;;
 *)



More information about the zaptel-commits mailing list