[zaptel-commits] tzafrir: trunk r2661 - in /trunk: xpp/utils/ zaptel.init

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Thu Jun 21 04:01:40 CDT 2007


Author: tzafrir
Date: Thu Jun 21 04:01:39 2007
New Revision: 2661

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2661
Log:
zaptel.init:
* Reduce nesting in hpec startup by moving it to a function.
* Fix a syntax error in hpec startup.
* Remove ztcfg -s from shutdown.
* Someone with a dynamic span, please test the suggested replacement
  (remmed-out).
* Reduced nesting in wait_for_xpp .

Ignore some generated man pages in xpp/utils

Merges: r2657 - r2660 from brnaches/1.4 .

Modified:
    trunk/xpp/utils/   (props changed)
    trunk/zaptel.init

Propchange: trunk/xpp/utils/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jun 21 04:01:39 2007
@@ -6,3 +6,7 @@
 print_modes
 init_fxo_modes
 wctdm_fxomodes.h
+xpp_blink.8
+xpp_sync.8
+zt_registration.8
+lszaptel.8

Modified: trunk/zaptel.init
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.init?view=diff&rev=2661&r1=2660&r2=2661
==============================================================================
--- trunk/zaptel.init (original)
+++ trunk/zaptel.init Thu Jun 21 04:01:39 2007
@@ -63,12 +63,11 @@
 
 # Wait for Astribank to initialize registers:
 wait_for_xpp() {
-	if [ -d /proc/xpp ]
-	then
-		# reading from waitfor_xpds only returns when the device
-		# has finished initilizing its regiters and is available.
-		cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null  || true
-	fi
+	if [ ! -d /proc/xpp ]; then return; fi
+
+	# reading from waitfor_xpds only returns when the device
+	# has finished initilizing its regiters and is available.
+	cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null  || true
 }
 
 # Register to zaptel Astribank spans that were not autoomatically registered
@@ -127,6 +126,57 @@
 	fi
 }
 
+hpec_start() {
+	# check for HPEC licenses
+	for f in /var/lib/digium/licenses/HPEC*.lic; do
+		if [ -f ${f} ]; then
+			haveHPEC=1
+		fi
+	done
+	if [ -z "${haveHPEC}" ]; then return; fi
+
+	# If we got here, HPEC license was found
+
+	# zaphpec_enable not installed in /usr/sbin
+	if [ ! -f /usr/sbin/zaphpec_enable ]; then
+		echo -n "Running zaphpec_enable: Failed"
+		echo -n "."
+		echo "  The zaphpec_enable binary is not installed in /usr/sbin."
+		return
+	fi
+
+	# zaphpec_enable not set executable
+	if [ ! -x /usr/sbin/zaphpec_enable ]; then
+		echo -n "Running zaphpec_enable: Failed"
+		echo -n "."
+		echo "  /usr/sbin/zaphpec_enable is not set as executable."
+		return
+	fi
+
+	# zaphpec_enable properly installed
+	if [ $system = debian ]; then
+		echo -n "Running zaphpec_enable: "
+		/usr/sbin/zaphpec_enable 2> /dev/null
+	elif [ $system = redhat ]; then
+		action "Running zaphpec_enable: " /usr/sbin/zaphpec_enable
+	fi
+	if [ $? = 0 ]; then
+		echo -n "done"
+		echo "."
+	else
+		echo -n "Failed"
+		echo -n "."
+		echo "  This can be caused if you had already run zaphpec_enable, or if your HPEC license is no longer valid."
+	fi
+}
+
+shutdown_dynamic() {
+	if ! grep -q ' ZTD/' /proc/* 2>/dev/null; then return; fi
+
+	# we should only get here if we have dynamic spans. Right?
+	$ZTCFG -s
+}
+
 # Check that telephony is up.
 [ "${TELEPHONY}" = "yes" ] || exit 0
 
@@ -201,48 +251,12 @@
 
 	[ $RETVAL -eq 0 ] && touch $LOCKFILE
 	
-	# check for HPEC licenses
-	for f in /var/lib/digium/licenses/HPEC*.lic; do
-		if [ -f ${f} ]; then
-			haveHPEC = 1
-		fi
-	done
-
-	# HPEC license found
-	if [ -n "${haveHPEC}" ]; then
-		# zaphpec_enable not installed in /usr/sbin
-		if [ ! -f /usr/sbin/zaphpec_enable ]; then
-			echo -n "Running zaphpec_enable: Failed"
-			echo -n "."
-			echo "  The zaphpec_enable binary is not installed in /usr/sbin."
-		else
-			# zaphpec_enable not set executable
-			if [ ! -x /usr/sbin/zaphpec_enable ]; then
-				echo -n "Running zaphpec_enable: Failed"
-				echo -n "."
-				echo "  /usr/sbin/zaphpec_enable is not set as executable."
-			else
-				# zaphpec_enable properly installed
-				if [ $system = debian ]; then
-					echo -n "Running zaphpec_enable: "
-					/usr/sbin/zaphpec_enable 2> /dev/null
-				elif [ $system = redhat ]; then
-					action "Running zaphpec_enable: " /usr/sbin/zaphpec_enable
-				fi
-				if [ $? = 0 ]; then
-					echo -n "done"
-					echo "."
-				else
-					echo -n "Failed"
-					echo -n "."
-					echo "  This can be caused if you had already run zaphpec_enable, or if your HPEC license is no longer valid."
-				fi
-			fi
-		fi
-	fi
+	hpec_start
 	;;
   stop)
 	# Unload drivers
+	shutdown_dynamic # FIXME: needs test from someone with dynamic spans
+
 	echo -n "Unloading zaptel hardware drivers:"
   	unload_module zaptel
 	RETVAL=$?




More information about the zaptel-commits mailing list