From ee9ef43a08a6c89168c7eca0983fc58a87fb4481 Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Thu, 11 Jun 1998 10:09:02 +0000
Subject: [PATCH] [project @ 1998-06-11 10:09:02 by sof] install-bin:    * if
 any of $(VERSION_SYMLINKS_FOR) already exists as a symlink,      replace it
 with a new one.

---
 distrib/Makefile-bin.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/distrib/Makefile-bin.in b/distrib/Makefile-bin.in
index 2c55f6d7395f..fdfdb6a94872 100644
--- a/distrib/Makefile-bin.in
+++ b/distrib/Makefile-bin.in
@@ -205,8 +205,15 @@ install-bin:
 	for i in $(VERSION_SYMLINKS_FOR) ""; do \
 	   if [ "x$$i" != "x" ]; then 		\
 	   	( cd $(bindir); 		\
-		  $(RM) $$i;			\
-		  $(LN_S) $$i-$(version) $$i	\
+		  if ( $(PERL) -e '$$fn="'$$i'"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
+	   	     echo "Creating a symbol link from $$i-$(version) to $$i"; \
+	   	     $(RM) $$i; \
+	             $(LN_S) $$i-$(version) $$i; \
+	          else \
+	             echo "Creating a symbol link from $$i-$(version) to $$i failed: \`$$i' already exists"; \
+	             echo "Perhaps remove \`$$i' manually?"; \
+	             exit 1; \
+	          fi;\
 		); 				\
 	   fi; 					\
 	done
-- 
GitLab