[zaptel-commits] branch 1.2 r1031 - /branches/1.2/Makefile

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Tue May 9 04:07:25 MST 2006


Author: kpfleming
Date: Tue May  9 06:07:24 2006
New Revision: 1031

URL: http://svn.digium.com/view/zaptel?rev=1031&view=rev
Log:
use commmand-line parameter substitution for modprobe commands if the system's module-init-tools is new enough to support it
don't backup and use the old configuration file for modules if we are using a zaptel-specific file in /etc/modprobe.d or similar

Modified:
    branches/1.2/Makefile

Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/Makefile?rev=1031&r1=1030&r2=1031&view=diff
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Tue May  9 06:07:24 2006
@@ -67,26 +67,36 @@
     else
       ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modprobe.conf))
         MODCONF:=$(ROOT_PREFIX)/etc/modprobe.conf
+	MODCONFBACKUP:=1
       else
         ifneq (,$(wildcard $(ROOT_PREFIX)/etc/conf.modules))
           MODCONF:=$(ROOT_PREFIX)/etc/conf.modules
+          MODCONFBACKUP:=1
         endif
       endif
     endif
   endif
+  # get the minor version of module-init-tools, since only 3.2.x and above support
+  # $CMDLINE_OPTS replacement
+  MODTOOLSVERSION:=$(shell modprobe --version | awk '{print $$3;}' | cut -d . -f2)
+  ifneq ($(MODTOOLSVERSION),1)
+    MODCMDLINE:=\$$CMDLINE_OPTS
+  endif
 else # BUILDVER == linux24
   ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modutils))
     MODCONF:=$(ROOT_PREFIX)/etc/modutils/zaptel
+    MODCONFBACKUP:=1
    else
     ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modules.conf))
       MODCONF:=$(ROOT_PREFIX)/etc/modules.conf
+      MODCONFBACKUP:=1
      endif
   endif
 endif
 
 ifeq (${BUILDVER},linux24)
 #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
-DYNFS:=$(shell ps ax | grep -v grep | grep -q devfsd && echo "yes")
+DYNFS:=$(shell ps ax | grep -q -v grep | grep -q devfsd && echo "yes")
 endif
 
 ifeq (${BUILDVER},linux26)
@@ -371,40 +381,45 @@
 		$(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER)
 	ln -sf $(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) \
 		$(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO)
-	if [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then restorecon -v $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO); fi
+	if [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep -q "SELinux status:" | grep -q "enabled") ; then restorecon -v $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO); fi
 	install -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
 	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
 	install -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
 	install -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8
 	if [ -n "$(MODCONF)" ]; then \
-		if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi; \
-		cat $(MODCONF).bak | grep -v "alias char-major-250" | \
-		grep -v "post-install torisa /sbin/ztcfg" | \
-		grep -v "post-install wcfxsusb /sbin/ztcfg" | \
-		grep -v "alias wctdm" | \
-		grep -v "post-install wctdm /sbin/ztcfg" > $(MODCONF); \
-		if ! grep "options torisa" $(MODCONF); then \
-			echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
-		fi; \
-		if ! grep "alias char-major-196" $(MODCONF); then \
-			echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \
+		if [ -n "$(MODCONFBACKUP)" ]; then \
+			if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi; \
+			cat $(MODCONF).bak | grep -q -v "alias char-major-250" | \
+			grep -q -v "post-install torisa /sbin/ztcfg" | \
+			grep -q -v "post-install wcfxsusb /sbin/ztcfg" | \
+			grep -q -v "alias wctdm" | \
+			grep -q -v "post-install wctdm /sbin/ztcfg" > $(MODCONF); \
+			if ! grep -q "options torisa" $(MODCONF); then \
+				echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
+			fi; \
+			if ! grep -q "alias char-major-196" $(MODCONF); then \
+				echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \
+			fi; \
+		else \
+			rm -f $(MODCONF) $(MODCONF).bak; \
+			touch $(MODCONF); \
 		fi; \
 		for x in $(MODULES); do \
 			if ! grep -q "post-install $$x" $(MODCONF); then \
 				if ! grep -q "install $$x " $(MODCONF); then \
 					if [ "$$x" != "zaptel" ] ; then \
-						if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x && /sbin/ztcfg" >> $(MODCONF); \
+						if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x $(MODCMDLINE) && /sbin/ztcfg" >> $(MODCONF); \
 						else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \
 						fi; \
 					fi; \
 				fi; \
 			fi; \
 		done; \
-		if ! grep "ias wcfxs" $(MODCONF); then \
+		if ! grep -q "alias wcfxs" $(MODCONF); then \
 			echo "alias wcfxs wctdm" >> $(MODCONF); \
 		fi; \
-		if ! grep "alias wct2xxp" $(MODCONF); then \
+		if ! grep -q "alias wct2xxp" $(MODCONF); then \
 			echo "alias wct2xxp wct4xxp" >> $(MODCONF); \
 		fi; \
 	fi
@@ -447,18 +462,18 @@
 		echo "Updating from Subversion..." ; \
 		svn update | tee update.out; \
 		rm -f .version; \
-		if [ `grep -c ^C update.out` -gt 0 ]; then \
+		if [ `grep -q -c ^C update.out` -gt 0 ]; then \
 			echo ; echo "The following files have conflicts:" ; \
-			grep ^C update.out | cut -b4- ; \
+			grep -q ^C update.out | cut -b4- ; \
 		fi ; \
 		rm -f update.out; \
 	elif [ -d CVS ]; then \
 		echo "Updating from CVS..." ; \
 		cvs -q -z3 update -Pd | tee update.out; \
 		rm -f .version; \
-		if [ `grep -c ^C update.out` -gt 0 ]; then \
+		if [ `grep -q -c ^C update.out` -gt 0 ]; then \
 			echo ; echo "The following files have conflicts:" ; \
-			grep ^C update.out | cut -d' ' -f2- ; \
+			grep -q ^C update.out | cut -d' ' -f2- ; \
 		fi ; \
 		rm -f update.out; \
 	else \



More information about the zaptel-commits mailing list