[Asterisk-cvs] zaptel Makefile, 1.65, 1.66 zaptel.init, 1.8, 1.9 zaptel.sysconfig, 1.1, 1.2

markster at lists.digium.com markster at lists.digium.com
Fri Jan 21 16:46:35 CST 2005


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv26007

Modified Files:
	Makefile zaptel.init zaptel.sysconfig 
Log Message:
Improve portability for debian (bug #3390)


Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- Makefile	14 Jan 2005 22:17:26 -0000	1.65
+++ Makefile	21 Jan 2005 22:49:26 -0000	1.66
@@ -33,7 +33,7 @@
 CFLAGS+=-DSTANDALONE_ZAPATA
 
 ROOT_PREFIX=
-INSTALL_PREFIX=
+INSTALL_PREFIX=$(DESTDIR)
 
 CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
 CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
@@ -203,9 +203,10 @@
 	ar rcs libtonezone.a $(TZOBJS)
 
 $(LIBTONEZONE): $(TZOBJS)
-	$(CC) -shared -Wl,-soname,libtonezone.so.1 -lm -o $@ $(TZOBJS)
+	$(CC) -shared -Wl,-soname,$(LIBTONEZONE) -lm -o $@ $(TZOBJS)
 	[ `id -u` = 0 ] && /sbin/ldconfig || :
-	ln -sf libtonezone.so.1 libtonezone.so                                  
+	ln -sf $(LIBTONEZONE) libtonezone.so                                  
+	ln -sf $(LIBTONEZONE) libtonezone.so.1                                  
 
 ztcfg.c: ztcfg.h
 
@@ -301,6 +302,7 @@
 	install -D -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/linux/torisa.h
 	install -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h
 	( cd $(INSTALL_PREFIX)/usr/lib ; rm -f libtonezone.so ; ln -sf $(LIBTONEZONE) libtonezone.so )
+	( cd $(INSTALL_PREFIX)/usr/lib ; rm -f libtonezone.so.1 ; ln -sf $(LIBTONEZONE) libtonezone.so.1 )
 	[ `id -u` = 0 ] && /sbin/ldconfig || :
 	if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi
 	cat $(MODCONF).bak | grep -v "alias char-major-250" | \
@@ -343,7 +345,10 @@
 		install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zaptel; \
 		chkconfig --add zaptel; \
 	fi 
-	if [ ! -f /etc/sysconfig/zaptel ]; then \
+	if [ -d /etc/default ] && [ ! -f /etc/default/zaptel ]; then \
+			install -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/default/zaptel; \
+	fi
+	if [ -d /etc/sysconfig ] && [ ! -f /etc/sysconfig/zaptel ]; then \
 		install -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/sysconfig/zaptel; \
 	fi
 	if [ -d /etc/sysconfig/network-scripts ]; then \
@@ -370,3 +375,5 @@
 	rm -f tor2ee
 	rm -f fxotune
 	rm -f core
+	[ -d .tmp_versions ] && rm -rf .tmp_versions
+

Index: zaptel.init
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.init,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- zaptel.init	14 Jan 2005 02:30:14 -0000	1.8
+++ zaptel.init	21 Jan 2005 22:49:26 -0000	1.9
@@ -8,33 +8,52 @@
 #
 # config: /etc/sysconfig/zaptel
 
-# Source function library.
-. /etc/rc.d/init.d/functions
+initdir=/etc/init.d
 
-[ -f /etc/sysconfig/zaptel ] || exit 0
+#
+# Determine which kind of configuration we're using
+#
+system=redhat  # assume redhat
+if [ -f /etc/debian_version ]; then
+    system=debian
+fi
 
-# Source zaptel configuration.
-. /etc/sysconfig/zaptel
+# Source function library.
+if [ $system = redhat ]; then
+    . $initdir/functions || exit 0
+fi
 
-# Check that telephony is up.
-if [ "${TELEPHONY}" = "no" ]; then
-	exit 0
+# Source zaptel configuration.
+if [ $system = debian ]; then
+    [ -f /etc/default/zaptel ] && . /etc/default/zaptel
+elif [ $system = redhat ]; then
+    [ -f /etc/sysconfig/zaptel ] && . /etc/sysconfig/zaptel
 fi
 
-[ -f /sbin/ztcfg ] || exit 0
+if [ -z "${MODULES}" ]; then 
+	# Populate defaults if not present
+	MODULES="tor2 wct4xxp wct1xxp wcte11xp wcfxo wctdm" 
+fi
 
-[ -f /etc/zaptel.conf ] || exit 0
+RMODULES=""
+# Reverse list for un-loading; don't change
+for x in $MODULES; do 
+    RMODULES="$x $RMODULES"
+done
 
-RETVAL=0
+# Check that telephony is up.
+[ "${TELEPHONY}" = "yes" ] || exit 0
 
-MODULES="torisa tor2 wct4xxp wcte11xp wct1xxp wcfxo wctdm wcusb"
+[ -f /sbin/ztcfg ] || exit 0
 
-RMODULES="wcusb wctdm wcfxo wct1xxp wcte11xp wct4xxp tor2 torisa"
+[ -f /etc/zaptel.conf ] || exit 0
 
 if [ "${DEBUG}" = "yes" ]; then
 	ARGS="debug=1"
 fi
 
+RETVAL=0
+
 # See how we were called.
 case "$1" in
   start)
@@ -42,14 +61,20 @@
 	rmmod wcusb >& /dev/null
 	rmmod wcfxsusb >& /dev/null
 	rmmod audio >& /dev/null
-	action "Loading zaptel framework: " modprobe zaptel
-        echo -n "Loading zaptel hardware modules: "
+	if [ $system = debian ]; then
+	    echo -n "Loading zaptel framework: " 
+	    modprobe zaptel >& /dev/null && echo -n "done"
+	    echo "."
+	elif [ $system = redhat ]; then
+	    action "Loading zaptel framework: " modprobe zaptel
+	fi
+        echo -n "Loading zaptel hardware modules:"
 	for x in $MODULES; do 
-		if insmod ${x} ${ARGS} >& /dev/null; then
-			echo -n "$x "
+		if modprobe ${x} ${ARGS} >& /dev/null; then
+			echo -n " $x"
 		fi
 	done
-	echo
+	echo "."
 	TMOUT=10 # max secs to wait
 	while [ ! -d /dev/zap ] ; do
  		sleep 1
@@ -59,34 +84,51 @@
 			exit 1
 		fi
 	done
-	sleep 1;
-	action "Running ztcfg: " /sbin/ztcfg
+	if [ $system = debian ]; then
+	    echo -n "Running ztcfg: " 
+	    /sbin/ztcfg >& /dev/null && echo -n "done"
+	    echo "."
+	elif [ $system = redhat ]; then
+	    action "Running ztcfg: " /sbin/ztcfg
+	fi
 	RETVAL=$?
 
         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zaptel
-
         ;;
   stop)
-        # Stop daemons.
-        echo -n "Unloading zaptel hardware drivers: "
+        # Unload drivers
+        echo -n "Unloading zaptel hardware drivers:"
 	for x in $RMODULES; do 
 		if rmmod ${x} >& /dev/null; then
-			echo -n "$x "
+			echo -n " $x"
 		fi
 	done
-	echo
+	echo "."
 
-	action "Removing zaptel module: " rmmod zaptel
+	if [ $system = debian ]; then
+	    echo -n "Removing zaptel module: " 
+	    rmmod zaptel >& /dev/null && echo -n "done"
+	    echo "."
+	elif [ $system = redhat ]; then
+	    action "Removing zaptel module: " rmmod zaptel
+	fi
 	RETVAL=$?
+
         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zaptel
         ;;
  restart)
 	$0 stop
 	$0 start
-	RETVAL=$?
 	;;
   reload)
-	action "Reloading ztcfg: " /sbin/ztcfg
+	if [ $system = debian ]; then
+	    echo -n "Reloading ztcfg: "
+	    /sbin/ztcfg >& /dev/null && echo -n "done"
+	    echo "."
+	elif [ $system = redhat ]; then
+	    action "Reloading ztcfg: " /sbin/ztcfg
+	fi
+	RETVAL=$?
 	;;
   *)
         echo "Usage: zaptel {start|stop|restart|reload}"

Index: zaptel.sysconfig
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.sysconfig,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- zaptel.sysconfig	6 Jun 2002 23:20:24 -0000	1.1
+++ zaptel.sysconfig	21 Jan 2005 22:49:26 -0000	1.2
@@ -1,2 +1,29 @@
 TELEPHONY=yes
 #DEBUG=yes
+
+# Un-comment as per your requirements; modules to load/unload
+#Module Name			  Hardware
+MODULES="$MODULES tor2"		# T400P - Quad Span T1 Card
+				# E400P - Quad Span E1 Card
+
+MODULES="$MODULES wct4xxp"	# TE405P - Quad Span T1/E1 Card (5v version)
+				# TE410P - Quad Span T1/E1 Card (3.3v version)
+
+MODULES="$MODULES wct1xxp"	# T100P - Single Span T1 Card
+				# E100P - Single Span E1 Card
+
+MODULES="$MODULES wcte11xp"	# TE110P - Single Span T1/E1 Card
+
+MODULES="$MODULES wcfxo"	# X100P - Single port FXO interface
+				# X101P - Single port FXO interface 
+
+MODULES="$MODULES wctdm"	# TDM400P - Modular FXS/FXO interface (1-4 ports)
+#MODULES="$MODULES wcfxs"	# either above or this
+
+MODULES="$MODULES wcusb"	# S100U - Single port FXS USB Interface
+#MODULES="$MODULES wcfxsusb"	# either above or this
+
+#MODULES="$MODULES torisa"	# Old Tormenta1 ISA Card
+
+#MODULES="$MODULES ztdummy"	# UHCI USB Zaptel Timing Only Interface
+




More information about the svn-commits mailing list