[zaptel-commits] tzafrir: branch 1.2 r2729 - /branches/1.2/Makefile

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Thu Jul 12 11:01:13 CDT 2007


Author: tzafrir
Date: Thu Jul 12 11:01:12 2007
New Revision: 2729

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2729
Log:
* config target: Replace shell scriptary with makefile logic.
* config target: Add a helpful text for the Zaptel installer.

Modified:
    branches/1.2/Makefile

Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/Makefile?view=diff&rev=2729&r1=2728&r2=2729
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Thu Jul 12 11:01:12 2007
@@ -124,9 +124,40 @@
 DYNFS:=$(shell ps ax | grep -v grep | grep -q devfsd && echo "yes")
 endif
 
-CHKCONFIG:=$(shell sh -c 'type -p chkconfig' 2> /dev/null)
-ifndef CHKCONFIG
-CHKCONFIG:=:
+# sample makefile "trace print"
+#tracedummy=$(shell echo ====== GOT HERE ===== >&2; echo >&2)
+
+CHKCONFIG	:= $(wildcard /sbin/chkconfig)
+UPDATE_RCD	:= $(wildcard /usr/sbin/update-rc.d)
+ifneq (,$(DESTDIR))
+  ifneq (,$(CHKCONFIG))
+    ADD_INITD	:= $(CHKCONFIG) --add zaptel
+  else
+    ifndef (,$(UPDATE_RCD))
+      ADD_INITD	:= $(UPDATE_RCD) zaptel defaults 15 30
+    endif
+  endif
+endif
+
+INITRD_DIR	:= $(firstword $(wildcard /etc/rc.d/init.d /etc/init.d))
+ifneq (,$(INITRD_DIR))
+  INIT_TARGET	:= $(DESTDIR)$(INITRD_DIR)/zaptel
+  COPY_INITD	:= install -D zaptel.init $(INIT_TARGET)
+endif
+
+NETSCR_DIR	:= $(firstword $(wildcard /etc/sysconfig/network-scripts ))
+ifneq (,$(NET_SCR_DIR))
+  NETSCR_TARGET	:= $(DESTDIR)$(NETSCR_DIR)/ifup-hdlc
+  COPY_NETSCR	:= install -D ifup-hdlc $(NETSCR_TARGET)
+endif
+
+RCCONF_DIR	:= $(firstword $(wildcard /etc/default /etc/sysconfig))
+ifneq (,$(RCCONF_DIR))
+  RCCONF_TARGET	:= $(DESTDIR)$(RCCONF_DIR)/zaptel
+  # Let's not step over an existing config file:
+  ifeq (,$(wildcard $(RCCONF_TARGET)))
+    COPY_RCCONF	:= install -D -m 644 zaptel.sysconfig $(RCCONF_TARGET)
+  endif
 endif
 
 ifneq ($(wildcard .version),)
@@ -416,22 +447,29 @@
 endif
 
 config:
-	if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \
-		install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/rc.d/init.d/zaptel; \
-		$(CHKCONFIG) --add zaptel; \
-	elif [ -d $(INSTALL_PREFIX)/etc/init.d ]; then \
-		install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zaptel; \
-		$(CHKCONFIG) --add zaptel; \
-	fi 
-	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 \
-		install -D -m 755 ifup-hdlc $(INSTALL_PREFIX)/etc/sysconfig/network-scripts/ifup-hdlc; \
-	fi
+ifneq (,$(COPY_INITD))
+	$(COPY_INITD)
+endif
+ifneq (,$(COPY_RCCONF))
+	$(COPY_RCCONF)
+endif
+ifneq (,$(COPY_NETSCR))
+	$(COPY_NETSCR)
+endif
+ifneq (,$(ADD_INITD))
+	$(ADD_INITD)
+endif
+	@echo "Zaptel has been configured."
+	@echo ""
+ifneq (,$(COPY_RCCONF))
+	@echo "If you have any zaptel hardware it is now recommended to "
+	@echo "edit $(RCCONF_TARGET) and set there an optimal value for "
+	@echo "the variable MODULES ."
+	@echo ""
+endif
+	@echo "I think that the zaptel hardware you have on your system is:"
+	@xpp/utils/zaptel_hardware || true
+
 
 update:
 	@if [ -d .svn ]; then \




More information about the zaptel-commits mailing list