summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-05-09 11:07:24 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-05-09 11:07:24 +0000
commitfb70e0343b22145adb2633e3a926a41297f072e5 (patch)
treef4f1ff948c8128f98551282b312e1ed15c00ee98 /Makefile
parente5e62cb69c97870719db4ca18260f9ed4669c3ca (diff)
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 git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1031 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile55
1 files changed, 35 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 6e3b562..d5a5443 100644
--- a/Makefile
+++ b/Makefile
@@ -67,26 +67,36 @@ ifeq ($(BUILDVER),linux26)
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: all devices
$(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 @@ update:
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 \