Index: Makefile =================================================================== RCS file: /usr/cvsroot/asterisk/Makefile,v retrieving revision 1.123 diff -u -r1.123 Makefile --- Makefile 20 Nov 2004 06:47:33 -0000 1.123 +++ Makefile 20 Nov 2004 11:52:47 -0000 @@ -61,9 +61,6 @@ ######### ppro's, etc, as well as the AMD K6 and K7. #K6OPT = -DK6OPT -#Overwite config files on "make samples" -OVERWRITE=y - #Tell gcc to optimize the asterisk's code OPTIMIZE+=-O6 @@ -423,6 +420,11 @@ @echo " + +" @echo " + $(MAKE) samples +" @echo " + +" + @echo " + To install the sample configuration files +" + @echo " + without overwriting the current one, run: +" + @echo " + +" + @echo " + $(MAKE) safe-samples +" + @echo " + +" @echo " +----------------- or ---------------------+" @echo " + +" @echo " + You can go ahead and install the asterisk +" @@ -438,6 +440,15 @@ upgrade: all bininstall +safe-adsi: all + mkdir -p $(DESTDIR)$(ASTETCDIR) + for x in configs/*.adsi; do \ + if [ ! -f $(DESTDIR)$(ASTETCDIR)/`basename $$x` ]; then \ + install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \ + fi ; \ + install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x`.sample ; \ + done + adsi: all mkdir -p $(DESTDIR)$(ASTETCDIR) for x in configs/*.adsi; do \ @@ -446,35 +457,48 @@ fi ; \ done -samples: all datafiles adsi +safe-samples: all all-samples datafiles safe-adsi + mkdir -p $(DESTDIR)$(ASTETCDIR) + for x in configs/*.sample; do \ + if [ ! -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \ + install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\ + fi; \ + install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \ + done + echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample + if [ ! -f $(DESTDIR)$(ASTETCDIR)/asterisk.conf ]; then \ + cp $(DESTDIR)$(ASTETCDIR)/asterisk.conf.sample $(DESTDIR)$(ASTETCDIR)/asterisk.conf; \ + fi + +samples: all all-samples datafiles adsi mkdir -p $(DESTDIR)$(ASTETCDIR) for x in configs/*.sample; do \ if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \ - if [ "$(OVERWRITE)" = "y" ]; then \ - if cmp -s $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $$x ; then \ - echo "Config file $$x is unchanged"; \ - continue; \ - fi ; \ - mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \ - else \ - echo "Skipping config file $$x"; \ + if cmp -s $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $$x ; then \ + echo "Config file $$x is unchanged"; \ continue; \ - fi ;\ + fi ; \ + mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \ fi ; \ install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\ done - if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTETCDIR)/asterisk.conf ]; then \ - echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ; \ - else \ - echo "Skipping asterisk.conf creation"; \ - fi + echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf + echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf + echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf + echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf + echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf + echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf + echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf + echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf + +all-samples: for x in sounds/demo-*; do \ if grep -q "^%`basename $$x`%" sounds.txt; then \ install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \