From 922b38851f3cf7eb4c282cef78377a239004c8f7 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Mon, 3 Aug 2015 13:13:34 +0200
Subject: [PATCH] Safer install

Do not "make uninstall" on "make install"

This could lead to data loss if prefixes are not properly set
---
 CHANGES/v2.2.txt | 2 ++
 src/lib/Makefile | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/CHANGES/v2.2.txt b/CHANGES/v2.2.txt
index 7adf439c0..03a1c90e9 100644
--- a/CHANGES/v2.2.txt
+++ b/CHANGES/v2.2.txt
@@ -88,5 +88,7 @@ For users:
   DESTDIR and other standard autoconf directories (e.g. bindir) are completely supported.
   Additionally, everything should work properly also when directory names include spaces (\issue{157}).
   Finally, compiler is not invoked on install unless path are explicitly changed (\issue{107}).
+- Related to installation refactoring, upon install a previusly installed plumed is not removed.
+  This is to avoid data loss if prefix variable is not properly set
 
 */
diff --git a/src/lib/Makefile b/src/lib/Makefile
index cded89614..5a6c8635f 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -116,7 +116,11 @@ ifdef PLUMED_LIBSUFFIX
 	@echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
 endif
 	cd ../config ; $(MAKE)
-	$(MAKE) uninstall
+# in principle we should uninstall before install
+# however, I think it is safer not to do it here since users could make mistake
+# and remove important files by just typing "sudo make install" with a 
+# malformed prefix variables
+	# $(MAKE) uninstall
 	mkdir -p "$(DESTDIR)$(bindir)"
 	mkdir -p "$(DESTDIR)$(libdir)"
 	mkdir -p "$(DESTDIR)$(includedir)/$(program_name)"
-- 
GitLab