Module: sip-router
Branch: kamailio_3.0
Commit: 1cae9198b490c833a44091974811caec8d8feef5
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1cae9198b490c833a44091974811caec8d8feef5

Author: Andrei Pelinescu-Onciul <[email protected]>
Committer: Andrei Pelinescu-Onciul <[email protected]>
Date:   Thu Mar  4 13:16:06 2010 +0100

makefile: fix modules config overwrite

A config file provided by a module was installed even if a
previous version was already installed, overwriting the old
version. Now if a file with the same name already exists, the
module config file will be installed with a .sample extension
added (so only .sample will be overwritten, never an active .cfg).

Reported-by: Klaus Darilion  klaus.mailinglists pernau at
Closes FlySpray#38 .
(cherry picked from commit 6c0de64647038072ba1959ead39dcc601fd6292c)

---

 Makefile.modules |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile.modules b/Makefile.modules
index 1f226ba..27cd0cd 100644
--- a/Makefile.modules
+++ b/Makefile.modules
@@ -16,6 +16,8 @@
 #              inside modules or libs) (andrei)
 #  2009-10-01  added support for automatically installing extra utils,
 #               scripts and cfg files (andrei)
+#  2010-03-04  don't overwrite already installed .cfgs, save the .cfg as
+#              .sample in this case (andrei)
 #
 
 #
@@ -209,10 +211,17 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
        @for r in $(MOD_INSTALL_CFGS) ; do \
                if [ -n "$$r" ]; then \
                        if [ -f "$$r" ]; then \
+                               n=`basename "$$r"` ; \
                                $(call try_err, $(INSTALL_TOUCH) \
-                                       $(cfg_prefix)/$(cfg_dir)/`basename 
"$$r"` ); \
+                                       "$(cfg_prefix)/$(cfg_dir)/$$n.sample" 
); \
                                $(call try_err,\
-                                       $(INSTALL_CFG)  "$$r"  
$(cfg_prefix)/$(cfg_dir) ); \
+                                       $(INSTALL_CFG)  "$$r"  \
+                                               
"$(cfg_prefix)/$(cfg_dir)/$$n.sample"); \
+                               if [ -z "${skip_cfg_install}" -a \
+                                               ! -f 
"$(cfg_prefix)/$(cfg_dir)$$n" ]; then \
+                                       mv -f 
$(cfg_prefix)/$(cfg_dir)$$n.sample \
+                                               $(cfg_prefix)/$(cfg_dir)$$n; \
+                               fi ; \
                        else \
                                echo "ERROR: $$r not found" ; \
                                if [ ${err_fail} = 1 ] ; then \


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to