Explorar el Código

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)
Andrei Pelinescu-Onciul hace 15 años
padre
commit
1cae9198b4
Se han modificado 1 ficheros con 11 adiciones y 2 borrados
  1. 11 2
      Makefile.modules

+ 11 - 2
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 \