From 97c9bb7486f2b9e13a59b3678955750bf83d2d7b Mon Sep 17 00:00:00 2001
From: Florent Gluck <florent.gluck@hesge.ch>
Date: Thu, 9 Jan 2025 11:32:31 +0100
Subject: [PATCH] nexus-server: install/update script saves previous
 nexus-server version in case a revert were necessary

---
 Makefile | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 0c286be..d08cb8e 100644
--- a/Makefile
+++ b/Makefile
@@ -104,15 +104,20 @@ copy_config_srv:
 	@cp -n config/server/users.json config/server/nexus.conf $(SERVER_BASEDIR)/config/
 	@echo "OK"
 
+# Only save the previous nexus-server binary (in case a revert were needed)
+save_old_srv_binaries:
+	@echo "Saving old server binaries"
+	@cp $(SERVER_BASEDIR)/bin/nexus-server $(SERVER_BASEDIR)/bin/nexus-server.old
+
 copy_binaries_srv:
-	@echo "Copying binaries"
+	@echo "Copying server binaries"
 	@cp src/server/nexus-server $(SERVER_BASEDIR)/bin
 	@cp tools/genpwd/genpwd $(SERVER_BASEDIR)/bin
 	@cp tools/template_creator $(SERVER_BASEDIR)/bin
 	@cp tools/vm_run $(SERVER_BASEDIR)/bin
 	@echo "OK"
 
-update_srv: check_prefix_var prepare_update_srv copy_binaries_srv
+update_srv: check_prefix_var prepare_update_srv save_old_srv_binaries copy_binaries_srv
 	@echo "Successfully updated nexus-server in $(SERVER_BASEDIR)"
 
 prepare_update_srv:
-- 
GitLab