From 67af1fecaa09c3358a342caef19c1d202e4e9b8e Mon Sep 17 00:00:00 2001 From: tzafrir Date: Thu, 12 Jul 2007 16:01:12 +0000 Subject: * config target: Replace shell scriptary with makefile logic. * config target: Add a helpful text for the Zaptel installer. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2729 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- Makefile | 76 ++++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 19 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e3ff115..fc8a03c 100644 --- a/Makefile +++ b/Makefile @@ -124,9 +124,40 @@ ifeq ($(BUILDVER),linux24) 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 @@ else 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 \ -- cgit v1.2.3