From c5a4f67935356e35745c1571ffda5619175ddda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Mon, 8 Jan 2018 11:11:42 +0100 Subject: Delete old .so and executable files before installing new one This fixes crash for people who have live ejabberd installed in make install target directory, by ensuring that loaded binaries aren't replaced in memory with new content. --- Makefile.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Makefile.in') diff --git a/Makefile.in b/Makefile.in index afc4d4ff..8006e074 100644 --- a/Makefile.in +++ b/Makefile.in @@ -149,15 +149,17 @@ define DEP_VERSION_template DEP_$(1)_VERSION:=$(shell $(SED) -e '/vsn/!d;s/.*, *"/$(1)-/;s/".*//' $(2) 2>/dev/null) endef +DELETE_TARGET_SO=$(if $(subst X.soX,,X$(suffix $(1))X),,rm $(call TO_DEST,$(1));) + $(foreach DEP,$(DEPS),$(eval $(call DEP_VERSION_template,$(DEP),deps/$(DEP)/ebin/$(DEP).app))) $(eval $(call DEP_VERSION_template,ejabberd,ebin/ejabberd.app)) define COPY_template -$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; $$(INSTALL) -m 644 $(1) $(call TO_DEST,$(1)) +$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; $(call DELETE_TARGET_SO, $(1)) $$(INSTALL) -m 644 $(1) $(call TO_DEST,$(1)) endef define COPY_BINARY_template -$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; $$(INSTALL) -m 755 $$(O_USER) $(1) $(call TO_DEST,$(1)) +$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; rm $(call TO_DEST,$(1)); $$(INSTALL) -m 755 $$(O_USER) $(1) $(call TO_DEST,$(1)) endef $(foreach file,$(DEPS_FILES_FILTERED) $(MAIN_FILES),$(eval $(call COPY_template,$(file)))) -- cgit v1.2.3