[svn-commits] tzafrir: branch linux/tzafrir/sysfs r5983 - /linux/team/tzafrir/sysfs/drivers...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Feb 8 02:38:52 CST 2009


Author: tzafrir
Date: Sun Feb  8 02:38:52 2009
New Revision: 5983

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=5983
Log:
Allow using a per-span template for system.conf

This is quick-and-dirty code. Improvements would be welcomed.

Modified:
    linux/team/tzafrir/sysfs/drivers/dahdi/span_hook.sample

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/span_hook.sample
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/span_hook.sample?view=diff&rev=5983&r1=5982&r2=5983
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/span_hook.sample (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/span_hook.sample Sun Feb  8 02:38:52 2009
@@ -29,13 +29,22 @@
 online)
 	span_name=`echo $SPAN_NAME | tr / _`
 	span_conf=/etc/dahdi/span-$span_name.conf
+	dev_file="/sys$DEVPATH"
 	if [ -r /etc/dahdi/system.conf ]; then
 		dahdi_cfg
 	elif [ -r "$span_conf" ]; then
-		# TODO: implement pattern matching here to make this case useful
-		dahdi_cfg -c "$span_conf"
+		tmpfile=`mktemp dahdi_span_XXXXXX`
+
+		base_channo=`cat $dev_file/*:01/channo`
+		export base_channo
+		# FIXME: check channel number of each channel:
+		perl -p -e 's/@([A-Z])+@/ENV{$1}/eg; s/@(\d+)@/($ENV{base_channo}+$1-1)/eg' \
+			<"$span_conf" >"$tmpfile"
+		dahdi_cfg -c "$tmpfile"
+		
+		#cat $tmpfile >&2
+		rm "$tmpfile"
 	else 
-		dev_file="/sys$DEVPATH"
 		tmpfile=`mktemp dahdi_span_XXXXXX`
 
 		# Generate a temporary configuration file for this span:




More information about the svn-commits mailing list