[svn-commits] tzafrir: tools/trunk r4855 - /tools/trunk/dahdi.init

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 28 16:40:23 CDT 2008


Author: tzafrir
Date: Thu Aug 28 16:40:23 2008
New Revision: 4855

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4855
Log:
Simplify reading list of modules from /etc/dahdi/modules .

Modified:
    tools/trunk/dahdi.init

Modified: tools/trunk/dahdi.init
URL: http://svn.digium.com/view/dahdi/tools/trunk/dahdi.init?view=diff&rev=4855&r1=4854&r2=4855
==============================================================================
--- tools/trunk/dahdi.init (original)
+++ tools/trunk/dahdi.init Thu Aug 28 16:40:23 2008
@@ -38,6 +38,8 @@
 if [ $system = redhat ]; then
     . $initdir/functions || exit 0
 fi
+
+DAHDI_MODULES_FILE="/etc/dahdi/modules"
 
 [ -r /etc/dahdi/init.conf ] && . /etc/dahdi/init.conf
 
@@ -148,30 +150,25 @@
 # See how we were called.
 case "$1" in
   start)
-	cat "/etc/dahdi/modules" | grep "^[^\#]" | {
-		foundone=false
-		echo "Loading DAHDI hardware modules:"
-		while read line; do
-			foundone=true
-			if [ $system = debian ]; then
-					echo -n "   ${line}: " 
-					if modprobe $line 2> /dev/null; then
-					echo -n "done"
-				else
-					echo -n "error"
-				fi
-			elif [ $system = redhat ]; then
-				action "  ${line}: " modprobe $line 
+  	modules=`sed -e 's/#.*$//' $DAHDI_MODULES_FILE 2>/dev/null`
+	#if [ "$modules" = '' ]; then
+		# what?
+	#fi
+	echo "Loading DAHDI hardware modules:"
+	modprobe dahdi
+	for line in $modules; do
+		if [ $system = debian ]; then
+			echo -n "   ${line}: " 
+			if modprobe $line 2> /dev/null; then
+				echo -n "done"
+			else
+				echo -n "error"
 			fi
-		done
+		elif [ $system = redhat ]; then
+			action "  ${line}: " modprobe $line 
+		fi
 		echo ""
-		if ! $foundone; then
-			echo "There aren't any DAHDI hardware modules specified to "
-			echo "load.  Please update /etc/dahdi/modules in order to "
-			echo "specify the modules to load."
-			exit 1
-		fi
-	}
+	done
 
 	TMOUT=$DAHDI_DEV_TIMEOUT # max secs to wait
 




More information about the svn-commits mailing list