[svn-commits] tzafrir: branch 1.4 r2734 - /branches/1.4/Makefile

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 12 19:46:16 CDT 2007


Author: tzafrir
Date: Thu Jul 12 19:46:16 2007
New Revision: 2734

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

(From branches/1.2 r2729)

Modified:
    branches/1.4/Makefile

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile?view=diff&rev=2734&r1=2733&r2=2734
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Thu Jul 12 19:46:16 2007
@@ -179,9 +179,40 @@
 CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
 CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
 
-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),)
@@ -506,26 +537,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; \
-		if [ -z "$(INSTALL_PREFIX)" ]; then \
-			$(CHKCONFIG) --add zaptel; \
-		fi; \
-	elif [ -d $(INSTALL_PREFIX)/etc/init.d ]; then \
-		$(INSTALL) -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zaptel; \
-		if [ -z "$(INSTALL_PREFIX)" ]; then \
-			$(CHKCONFIG) --add zaptel; \
-		fi; \
-	fi 
-	if [ -d $(INSTALL_PREFIX)/etc/default ] && [ ! -f $(INSTALL_PREFIX)/etc/default/zaptel ]; then \
-			$(INSTALL) -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/default/zaptel; \
-	fi
-	if [ -d $(INSTALL_PREFIX)/etc/sysconfig ] && [ ! -f $(INSTALL_PREFIX)/etc/sysconfig/zaptel ]; then \
-		$(INSTALL) -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/sysconfig/zaptel; \
-	fi
-	if [ -d $(INSTALL_PREFIX)/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 svn-commits mailing list